Categories
Uncategorized

pbcopy and pbpaste

In Mac OS X there exists a command named pbcopy which according to my notes, copies standard input to the GUI’s copy buffer…

In Mac OS X there exists a command named pbcopy which according to my notes, copies standard input to the GUI‘s copy buffer, or pasteboard for the technical among you. Which, in english, means you can pipe stuff into pbcopy, and then use the old ‘Command-V’ to paste it where you like.

So in the Terminal you type:

uname -a | pbcopy

and back in your standard Mac OS X application you you can paste the result, which in this case is:

Darwin MacOSX.local. 6.5 
Darwin Kernel Version 6.5: 
Mon Apr  7 17:05:38 PDT 2003; 
root:xnu/xnu-344.32.obj~1/RELEASE_PPC 
Power Macintosh powerpc

Of course you can find more interesting things to pipe into pbcopy I’m sure, here’s some ideas:

  • perl -V
  • sw_vers
  • hostinfo

Oh, there’s also pbpaste, basically the reverse of pbcopy, for when you want some command line pasting action that comes from the GUI’s pasteboard…