Copy to clipboard from terminal in OS X
To copy something to the clipboard using the terminal seems to be pretty simple in Mac OS X. There's this command
pbcopy that copies whatever is passed to it from the terminal into the clipboard (aka pasteboard in OS X, hence the command "pb" and not "cb").
To use it's just this simple:
echo 'lol' | pbcopy
This will copy "lol" into your clipboard. Now you can paste it in your browser, mail or whatever. And if you want to paste this also from the terminal, you can use
pbpaste, to do it:
pbpaste > file.txt
This will paste the previous copied "lol" into "file.txt".
I've googled for something similar in Linux, and found xclip, but it seems that it doesn't work with the graphical paste. You can only paste the output using the wheel mouse button.
Oh, and by the way, this the first 2009 post, so Happy New Year! :)