Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using xclip to copy terminal content to the clip board on Linux

Using xclip to copy terminal content to the clip board:

Say you want to pipe shell output to your clipboard on Linux. How would you do it? First, choose the clipboard destination, either the Mouse clip or the system clipboard.

For the mouse clipboard, pipe straight to xclip:

echo 123 | xclip

For the system clip board, pipe to xclip and select clip directly:

echo 123 | xclip -sel clip

See the man file of xclip here.

Copy link

willsilvano commented Jun 28, 2019

Thanks! @aminelch

Copy link

dreua commented May 25, 2021

Thanks, just added alias xcli-actual-clipboard='xclip -sel clip' as a reminder & shortcut for future me.

Copy link

Brainiarc7 commented May 25, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment