Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

(I use Ubuntu with default Gnome and Bash.)

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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/

share|improve this answer
    
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/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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