Redirect Linux terminal to clipboard

clipboardgrep

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

Best Answer

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