This article on command line calculation has a few interesting points on interfacing with cutbuffers on unixoid operating systesm.

Mac OS has a couple of handy command line utilities: pbcopy and pbpaste.

Linux takes a little more effort. This python should work on most linux systems:

import pygtk
pygtk.require('2.0')
import gtk

clipboard = gtk.clipboard_get()
clipboard.set_text("Your string here.")
clipboard.store()