Gone from Suck to Blow

Want to move a URL or other text between your local computers, and they're not all Mac/iOS where universal pasteboard mostly works? There's smart ways, and then there's how I do it:

# note: needs Apache turned on. sudo apachectl start
mac% cd /Library/WebServer/Documents
mac% sudo ln -s $HOME/Sites
mac% cd
mac% cat bin/blow
pbpaste >$HOME/Sites/suckblow.txt

raspi% sudo apt-get xclip
raspi% cat bin/suck
curl -s "http://mac.local/Sites/suckblow.txt" |xclip -i -selection clipboard
xclip -o -selection clipboard

And in the reverse set, pbcopy is the Mac equivalent of xclip -i. In practice, I don't run a server on my RasPi but I rarely need to paste the other way, just sometimes scp files.

Now on the Mac, I copy some text, type "blow" in iTerm2. On the RasPi, I grab terminal and type "suck". It can take a few seconds, and then the text is in clipboard.

Without running Apache (or other web server, but I'm a caveman), you can use scp to grab the file, then cat it into xclip -i.

Happy blowing & sucking!

[Update 2022-12-03: Some update on raspi changed the default in xclip from clipboard to primary (X11). So I've added -selection clipboard to them all.]

%d bloggers like this: