pbpaste and pbcopy in Mac OS X (copy/paste on the command line)
Although the OS X shell is very powerful, some useful commands are not very known. This is specially true for pbcopy and pbpaste, which can be used for several different automation operations or just copying/pasting contents from stdin/stdout.
Copy contents from standard input (stdin) into the clipboard.
date | pbcopy
The current date is copied to the clipboard. Check it pressing ⌘+v (command+v on a Mac) in a text editor - or even in the terminal window - to paste the current date to the clipboard.
Pastes the content from the clipboard to standard output (stdout).
This will echo the contents of the clipboard. If you have used the pbcopy example above, the current date will be displayed.