Copy terminal output to clipboard Mac OS X

Written by
Date: 2012-05-06 08:03:00 00:00


If you want to copy the result of any command in the terminal in your Mac to clipboard. For example if you need to use that info in a Pages document, or to paste it in your blog or forum. Use pbcopy

Just pipe the output of the command in the terminal to pbcopy and they will directly to Mac's clipboard.

ls | pbcopy

or

echo "Copy this into Mac's clipboard" | pbcopy

If you then need to paste it into a file also using the terminal, use pbpaste

pbpaste > ~/some-file.txt