Pasteboard in Mac OS X
Friday, August 26, 2005 at 1:13PM You can manipulate the Pasteboard from the command line interface with
pbcopy (which takes from stdin and copies it to the clipboard) and pbpaste (which dumps the content of the clipboard to stdout). This means that, for example, you can dump the output of a shell script straight to the clipboard, rather than letting it flow to stdout, then selecting and copying the output from the terminal (something I do quite often, particularly when I'm trying to write documentation or tutorials).The other thing I learned (both from the
pbcopy(1) manual page and from a post on the TextMate users mailing list) was that there are multiple Pasteboards in Mac OS X. According to the man page, they are named 'general', 'ruler', 'find' and 'font'. General is where stuff goes by default. I've don't know what 'ruler' and 'font' do, but I can guess they're for copying and pasting particular artefacts (so you can copy'n'paste text formatting rather than the text itself in the case of 'font'?). Find is an interesting one. Select a piece of text in a Cocoa app. Hit ⌘-E to copy this text to the 'find' pasteboard. Now go to the 'find' window. Note that the text you pushed to the 'find' pasteboard is now in the 'Find' box, automagically. And it's all done without disturbing what's currently on your main pasteboard.
Geekery
Reader Comments (1)
Ahhh! So *that's* why, when I entered a find string in TextMate, and then opened up the file in BBEdit and opened its find dialog...the string was already there.
It really creeped me out when it happened. Way too prescient. Now I know why :)