An easy way to manipulate the clipboard from the command line is by using the pbcopy and pbpaste commands.
pbcopy will copy standard input to the clipboard–the following would be example usages:
echo "MacTips Rocks" | pbcopy (Copies “MacTips Rocks” to the clipboard)
pbcopy < file (Copies the contents of file to the clipboard)
ls -la | pbcopy (Copies the current directory listing to the clipboard)
Similarly, pbpaste will paste the clipboard contents to standard output:
pbpaste (Output the clipboard contents to the screen)
pbpaste > file (Output the clipboard contents to file)

Jeremy Kemp
[-pboard {general | ruler | find | font}]
So, with the caveat that the system might overwrite one of the non-general boards, you can use all four to your liking! August 31st, 2005 at 4:29 pm
Trackback
[...] Mactips.org provides an nice article on how to manipulate your clipboard from command line. This makes you use commands like this to fill your clipboard: $ echo “fnord” | pbcopy [...]
September 1st, 2005 at 11:34 amTrackback
[...] Manipulate Clipboard from the Command Line [...]
December 23rd, 2007 at 4:28 pm