Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In a terminal in OSX I can pipe output to pbcopy and then go into a web browser and paste it. I tried this in Linux with xcopy but when I switch to the browser it just overwrites the clipboard with with whatever was in it the last time the browser was used. What works like pbcopy in Linux?

share|improve this question
1  
...and for those that don't know what pbcopy is, here's the man page developer.apple.com/library/mac/#documentation/Darwin/Reference/… –  Rob Cowell May 25 '11 at 9:48
    
+1 for my new favorite tool! –  Chris Nava May 25 '11 at 14:09

1 Answer 1

up vote 41 down vote accepted

if you have X installed you may try xsel in this way :

alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'

or with xclip :

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

now you can use'em :

echo 'go to my clipboard' | pbcopy

when I don't have X I use GNU Screen functionality to copy between open shells in a session using keyboard

to copy : Ctrl-a -> Esc -> go to wanted position * -> Space (to begin selecting) -> press k to go forward mark text -> Enter

to paste : Ctrl-a + ]

* movements are done with vim like key bindings (j, k, l & m).

share|improve this answer
1  
Thanks this is exactly the information I wanted. Tho now I wonder if there is a way I could make Screen let me use Emacs commands to select the area I want to copy... –  Noah Sussman Dec 31 '11 at 16:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.