How to use pbcopy and pbpaste

Using pbcopy and pbpaste

# This will copy all the content within a file.
$ cat myfile.txt | pbcopy
# This will output the contents of your clipboard.
$ pbpaste

Copy and pasting for Linux

# Linux version of OSX pbcopy and pbpaste.
alias pbcopy=’xsel — clipboard — input’
alias pbpaste=’xsel — clipboard — output’
# This will copy all the content within a file.
$ cat myfile.txt | pbcopy
# This will output the contents of your clipboard.
$ pbpaste

--

--

Senior Web Engineer at Stash. I write about NYC, tech, and the immensity of life.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store