

Here’s how to use pbpaste to send the contents of your clipboard to another machine, by piping the output through an ssh connection into a file named myclipboard.The clipboard is one of the most basic and essential pieces of every operating system. Pbcopy and pbpaste are a lot more powerful than the above examples though. Pbcopy and pbpaste can even work across networks by using ssh or other protocols, check this out: Pasting Clipboard Contents Across Networks with SSH & pbpaste You can learn more about modifying the clipboard from the terminal by redirecting command output here with pipes and redirects to the pbcopy command. Now that you’ve copied something to the clipboard of OS X with pbcopy you can dump the output back into the Terminal by using pbpaste, if you had just run the ls -lha|pbcopy command, the output will be that. This will pipe the results of ls -lha into your clipboard, which you can now access using the pbpaste command. The best way to use it is by piping something into pbcopy, for example: This is basically like using Comamnd+C in the Finder or GUI of OS X. Pbcopy – as you might imagine, pbcopy is how you can copy things from the command line.

Adding Contents to the Clipboard with pbcopy You can double-check this by opening it in any text editor, or by typing cat clipboard.txt to see the contents. Now you’ll have the document clipboard.txt with the contents of your clipboard. You can also easily store the contents of the clipboard into a file by using pbpaste, as follows: You’ll see whatever is stored in the clipboard right now, as if you hit Command+V in OS X. If you just want to see what’s in the clipboard, simply type this: Pbpaste – pbpaste is how you dump the currently active contents of the clipboard.

Accessing the OS X Clipboard Contents with pbpaste
