Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save apoos-maximus/20293078a49177a5a111520910a29c3f to your computer and use it in GitHub Desktop.

Select an option

Save apoos-maximus/20293078a49177a5a111520910a29c3f 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.

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