Search

3/10/2012

pbcopy / pbpaste in Ubuntu (command line clipboard)

pbcopy / pbpaste in Ubuntu (command line clipboard)

In Ubuntu(or any Linux distro with Xwindows), a similar tool is xclip. I like to make this alias:

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
or the following also works if you would rather use xsel:

alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
Now you can pipe any text to pbcopy

$ cat ~/.ssh/id_dsa.pub | pbcopy
Your public ssh key is transferred to your clipboard and is ready to be pasted(perhaps with pbpaste).

沒有留言: