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”

  1. WordPress database error: [Table './blowery_blog/wp_commentmeta' is marked as crashed and last (automatic?) repair failed]
    SELECT comment_id, meta_key, meta_value FROM wp_commentmeta WHERE comment_id IN (2603,14280,14346) ORDER BY meta_id ASC

    pc accessories says:

    Nice article, i love it, thanks for sharing

Comments are closed.