
This is a page from an upcoming zine called "The Secret Rules of the Terminal".
To get an email when the zine comes out, sign up for the zine announcements list!

read the transcript!
multiline
It’s SO scary when you paste a bunch of commands by accident and then it runs them all.
fish, zsh, and newer bash versions protect you from this: you have to press Enter
before running the thing you pasted. This is called “bracketed paste”
problem: copying with the mouse can go wrong
- copying 400 lines of text by dragging is nobody’s idea of a good time
- sometimes extra whitespace that you didn’t want gets added at the end of lines
panel 3
smiling stick figure with short curly hair: “copying a LOT of text is way easier if you don’t use the mouse! Here are 2 tricks for copying without the mouse. “
copy trick 1: pbcopy
macOS comes with two programs that can copy from stdin / paste to stdout, like this:
cat main.go | pbcopy
They’re SO useful and on Linux I like to write my own versions of pbcopy
/pbpaste
using xsel
or xclip
pbcopy over SSH
you can even implement pbcopy over SSH (yes really!) with this bash one-liner.
It uses an escape code called “OSC 52”.
printf "\033]52;c;%s\007"
"$(base64 | tr -d '\n')"
copy trick 2: syncing the vim clipboard
I use vim as a terminal text editor, and I find it’s WAY easier if I sync my system clipboard with the vim clipboard like this:
set clipboard=unnamed
tmux
can also copy to your system clipboard.
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!