I just found out there are a couple of commands that let you interact with the clipboard (aka pasteboard) from the shell on Mac OS X. The two comands are pbcopy and pbpaste (probably standing for pasteboard copy and pasteboard paste).

You can pipe to them just like other commands. So if you want a Unixy directory listing you could do something like:

ls -Flah | pbcopy

Using pbcopy The information goes right to your clipboard, and you can then command+v to get the information back out, or if you want to get infromation from the clipboard into a script you can just do pbpaste. Something like:

pbpaste | awk '{print $9}'

fun fun