xclip - command line interface to X selections (clipboard)

xclip reads from standard in, or from one or more files, and makes the data available as an X selection for pasting into X applications. Prints current X selection to standard out.

To install sudo apt-get install xclip

How to work with xclip , say for example you want an output of a command in your X selection , after running commnad | xclip , you can just middle click your mouse to paste the output or else you may use the -o option  xclip -o /path/file-name .

Say for example :

uptime | xclip

Put your uptime in the X selection. Then middle click in an X application to paste.

xclip -loops 10 -verbose /etc/motd>/code>
 
Exit after /etc/motd (message of the day) has been pasted 10 times. Show how many selection requests (pastes) have been processed.
 
<code> xclip -o > helloworld.c 

Put the contents of the selection into a file.

Share this