Copy to Clipboard in the Command Line Interface (CLI)

Ever wonder how to copy something from the command line into the Mac OS clipboard? If you want to copy/paste a files content (perhaps a log file or a conf file, etc) into the clipboard to use outside of the CLI, you can use the commands pbcopy and pbpaste. Example: I want to copy the contents of my public key to the clipboard (so I can send it to a server admin who will use it in allowing me to access their subversion repository).

All I would need to do is:
cat | pbcopy

(cat writes out the content and then it is piped (|) into the clipboard) This comes in handy!