OS X clipboard from Terminal

Two commands, pbcopy and pbpaste, allow you to set and get stuff from the OS clipboard. One instance where this is handy is if you want to copy and paste the output of a command or the contents of a file. For example:

find . type f | pbcopy

or

cat <filename> | pbcopy

And to use the clipboard contents:

echo $(pbpaste)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s