Copy Shell Output

Dev tip 4/99

paydro
paydro
Aug 28, 2017 · 1 min read

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!

100 Days Of Development Tips

I take the 100 Day challenge and write down the developments tips I’ve accumulated over the years as a professional software developer.

)
paydro

Written by

paydro

I jump on boxes.

100 Days Of Development Tips

I take the 100 Day challenge and write down the developments tips I’ve accumulated over the years as a professional software developer.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade