Access Clipboard from Terminal on MacOS using pbcopy and pbpaste
· One min read
On MacOS
pbcopy and pbpaste are Cmd+C/V for ClipBoard.
They work by piping stuff into them.
To write to clipboard:
echo "Hello" | pbcopycat file.txt | pbcopy
To read from the clipboard:
pbpastepbpaste > file.txt
For Linux see xclip with xclip -selection clipboard and xclip -o -selection clipboard) (it is ugly, so use bash aliases.)