Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .