Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Created April 26, 2017 17:53
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save Brainiarc7/f5eb9a91973b62a0f71b4c4c6fbb9e03 to your computer and use it in GitHub Desktop.
Save Brainiarc7/f5eb9a91973b62a0f71b4c4c6fbb9e03 to your computer and use it in GitHub Desktop.
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.

@aminelch
Copy link

thank you
i use it as a alia on my zh terminal
alias ccc="xclip -sel clip"

@willsilvano
Copy link

Thanks! @aminelch

@dreua
Copy link

dreua commented May 25, 2021

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

@Brainiarc7
Copy link
Author

Brainiarc7 commented May 25, 2021 via email

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