Linux never stops surprising me, I discover a new application, or a new tip every day, I have been with no time this last months so I could not write here as much as I would like.

Anyway, let me share this tip with you.

Today tool is xclip first of all install it


sudo aptitude install xclip


sudo yum instal xclip

And for my favorite distro

sudo pacman -S xclip

This great tool sends the output of shell commands to clipboard, which is very useful, if for example you want to create a document containing man pages, to do that just enter:

man htop | xclip

Then go to your favorite word editor and use , or or the middle mouse button to paste the contents of clipboard to your document.

You can copy the output of any command for instance free

free | xclip

These are the results:

             total       used       free     shared    buffers     cached
Mem:       2064156    1114088     950068          0      69860     455464
-/+ buffers/cache:     588764    1475392
Swap:      2650684          0    2650684

You can also send the output of the clipboard to a command for instance, if you want to echo some text into a file.

Just select the text from a webpage, use to copy to clipboard, and then in the console run this:

xclip -o > file.txt

Read the xclip man page for more info