Unix Trick: PBCopy

Last week I blogged about my favorite Unix trick. Today I’m going to look at another – PBCopy.

This one only exists in OSX – it allows you to interact with the clipboard through the command-line. For example, if you want to copy the contents of your ssh key to the clipboard you can do the following:

pbcopy < ~/.ssh/id_rsa.pub

You can also pipe into it, so the following will put the contents of the readme file on the clipboard:

cat README.md | pbcopy

Happy coding.