Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to redirect the output of your terminal in linux to the clipboard? Right now I am using Ubuntu 9.10 and I simply right click and "copy" the selected text. It would be a lot easier if I could go like this...

grep sometext myfile || clipboard
share|improve this question

1 Answer 1

up vote 3 down vote accepted

The xclip package will do this. Another similar tool that is also frequently useful is pastebinit.

Usage is simple just do something like cat /etc/passwd | xclip.

It is also possible, to take the contents of the clipboard and use it with a command like xclip -out | grep 'foo'.

share|improve this answer
This makes my day. – bstpierre Jan 22 '10 at 23:56

Your Answer


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.