Home

Awesome

pbproxy - send your clipboard anywhere you can ssh to

TL;DR: pbcopy and pbpaste from any (mac or linux) machine you can ssh to

This is a simple tool to make it easy to interact with clipboards on remote machines. The "ui" mimics macOS's pbcopy and pbpaste commands using the original pbcopy and pbpaste on macOS, and wrapping xsel on Linux boxes. On linux boxes where xsel is not available (eg headless servers that don't have X) it falls back to storing clipboard contents in a temp file

In other words, you can pbcopy and pbpaste from any remote machines you have ssh access to. The special sauce is that you can put a server name from your ssh config on the end of a pbcopy or pbpaste command so you can do stuff like run echo hello | pbcopy server2 on server1, after which doing pbpaste from server2 would print 'hello'. You can also do this in the other direction with pbpaste, eg from server2 you can run pbpaste server1 and it'll print out the contents of server1's clipboard.

Prereqs:

For best results:

Usage:

NOTE: This tool works the same way regardless of whether it's running on a macOS or a linux machine. On macs it wraps the native pbcopy and pbaste commands, and on linux it uses xsel or a temp file

Installation

For the lazy (read: efficient), copy/pasting this quick and dirty shell snippet should get the job done:

git clone https://github.com/nikvdp/pbproxy ~/.pbproxy
ps | grep $$ | grep -q zsh && echo 'export PATH="$HOME/.pbproxy:$PATH"' | tee -a ~/.zshrc
ps | grep $$ | grep -q bash && echo 'export PATH="$HOME/.pbproxy:$PATH"' | tee -a ~/.bashrc
export PATH="$HOME/.pbproxy:$PATH"
hash -r

Alternatives

If you know of any other tools in this space feel free to open a PR to include them here!