Linux – Manipulate system clipboard via bash script

bashclipboardlinux

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

(I use Ubuntu with default Gnome and Bash.)

Best Answer

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/