‘Holy crap I didn’t know that was there’ feature of the day:
PBCOPY(1) PBCOPY(1) NAME pbcopy, pbpaste - provide copying and pasting from command line SYNOPSIS pbcopy [-help] [-pboard {general | ruler | find | font}] pbpaste [-help] [-pboard {general | ruler | find | font}] [-Prefer {ascii | rtf | ps}] DESCRIPTION pbcopy takes the standard input and places it in the specified paste- board. If no pasteboard is specified, the general pasteboard will be used by default. The input is placed in the pasteboard as ASCII data unless it begins with the Encapsulated PostScript (EPS) file header or the Rich Text Format (RTF) file header, in which case it is placed in the pasteboard as one of those data types. pbpaste removes the data from the pasteboard and writes it to the stan- dard output. It normally looks first for ASCII data in the pasteboard and writes that to the standard output; if no ASCII data is in the pasteboard it looks for Encapsulated PostScript; if no EPS if present it looks for Rich Text. If none of those types is present in the pasteboard, pbpaste produces no output.
man pbcopy
for more info