Accessing the clipboard from OS X command-line
pbcopy and pbpaste are the OS X alternatives to the POSIX tool xclip.
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.
pbpaste removes the data from the pasteboard and writes it to the standard output.
For example:
user@host:~/Projects/some/dir/that/is/long$ pwd | pbcopy
The working [...]