I have a files where I need to copy their contents to another file or into an application and rather than open it up, select all the text then copy and paste I'd like to know if I can effectively cat the file contents into the clipboard. Is this possible?

A Windows program would be fine but something that works on Linux would be useful too. I don't use a Mac but it might be useful to others. Bonus points if this can be done on the command line.

link|improve this question

57% accept rate
1  
Aha, I knew it was asked before, for Windows: "How to pipe text from command line to the clipboard" at superuser.com/questions/97762/… Maybe leave this open for Linux then? – Arjan Feb 25 '10 at 21:56
1  
Suburb. Looks like I can use clip.exe for this. Would still like a non-command line version though. Maybe via Windows Explorer context menu? – Jonathon Watney Feb 25 '10 at 22:08
feedback

3 Answers

Since you didn't ask about Macs: cat file | pbcopy (and likewise pbpaste) for those.

link|improve this answer
Darn. I don't use a Mac. Will keep for future reference though. ;) – Jonathon Watney Feb 25 '10 at 21:53
feedback

In Linux you can use xsel to mimic pbcopy & pbpastel

link|improve this answer
feedback

xclip (probably available in your Linux system's repos) will work for any X11 system, including most Linux versions, or even X being run under windows or Mac OSX.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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