Copy to clipboard from command line

I just discovered a couple useful command-line tools on OSX and thought I’d share. pbcopy will copy stdin to the clipboard and pbpaste will send the clipboard to stdout.

$ cat somefile.txt | pbcopy #copy a file to the clipboard
$ pbpaste | grep foo #search the clipboard for foo


3 thoughts on “Copy to clipboard from command line”

Comments are closed.