Copy Shell Output
Dev tip 4/99
Published in
1 min readAug 28, 2017
There are many times where I need the output of a shell command in another application (e.g., Slack, Chrome, etc). Selecting the output of a command with the mouse so I can copy doesn’t scale when the output is multiple screens long.
Luckily, OS X comes with a pair of nifty command line tools to help with this — pbcopy
and pbpaste
. Pipe a command into pbcopy
to copy the output to the OS X clipboard — ready to paste in another application. Here’s an example:
$ cat /var/log/syslog | pbcopy
I haven’t found too much use of pbpaste
but it is listed for completeness. If you have uses for it, please let me know!