This is just a quick tip, but it’s pretty handy nevertheless.
Ever once in a while I find that it would be handy to be able to copy things, such as a file contents or command output, from the command line to the mac clipboard.
It turns out this is actually pretty simple using a command called pbcopy.
Here is an example of getting the contents of a file, we will use testfile.txt, so that I can paste it into a document I am working on:
$ cat testfile.txt | pbcopy
Now you can paste the contents into any desktop app.