pbcopy & pbpaste: Manipulating the Clipboard from the Command Line
Copy and Paste are absolute necessities for virtually all computer users, and if you find yourself working in the command line frequently, you’ll want to know how to manipulate the clipboard of Mac OS X directly from the terminal prompt. That’s what the Mac commands pbcopy and pbpaste are for, and as you may have guessed the two commmands do exactly what they sound like, pbcopy is to copy, and pbpaste is to paste through the command line. They’re actually quite powerful and you’ll be sure to find them useful the next time you’re hanging out with your bash, tcsh, zsh, or whatever is your preferred shell prompt.
We will cover a quick explanation on how to use pbcopy and pbpaste to manipulate clipboard data, with some examples indicating how to redirect the output of terminal commands as input into the clipboard, and of course, how to expel the contents of the clipboard into the command line with pbpaste.