Copy to Clipboard in the Command Line Interface (CLI)

Apple UNIX

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 id_dsa.pub | pbcopy

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

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Apple

It is Apple Keynote Time Again…

I love the day of big Apple keynotes given by Steve Jobs. While rummaging around for a disk utility last week – I found my copy of the Macworld 1999 keynote where the Blue and White G3s and multi-flavored iMacs were announced. I had a smile – I eventually owned both and thought they were […]