Is it possible to have a bash script put some text in the system clipboard?

(I use Ubuntu with default Gnome and Bash.)


There is a commandline tool xclip .
Example: Copy output of the following command to clipboard:

$ sort -n -k 3, -k 2 file.txt | xclip

Tutorial: http://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/

  • Accepted, for I could install it via my package manager. Thank you.
    – DerMike
    Dec 21 '11 at 14:20

I haven't tried it on my own, but there is a Bash Clipboard Interactive Script project on SourceForge: http://bics.sourceforge.net/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.