Last Updated: February 25, 2016
·
1K
· allankent

terminal output to clipboard

pbcopy,  pbpaste  -  provide copying and pasting to the pasteboard (the
   Clipboard) from command line

OSX has a neat command line app, pbcopy that takes any input and sticks it into the clipboard. Handy if you want to take some terminal output and work with it in a windowed application.

To use, simply pipe your output into pbcopy:

ls -l | pbcopy

The output of your ls command is now on the clipboard for you to paste wherever needed.

1 Response
Add your response

In Linux, it's called xclip. And pbcopy doesn't work through tmux unless you

brew install reattach-to-user-namespace

and add

set-option -g default-command "reattach-to-user-namespace -l zsh" # or bash

to your ~/.tmux.conf.

over 1 year ago ·