xclip – interface to X clipboard

I recently discovered this handy utility called xclip which is command line interface to X selections (clipboard) .

see xclip man page


uptime | xclip

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

xclip -loops 10 -verbose /etc/motd

Exit after /etc/motd (message of the day) has been pasted 10 times. Show how many selection requests (pastes) have been processed.

xclip -o > helloworld.c

Put the contents of the selection into a file.


Note: make sure you are using alias xclip=”xclip -selection c” otherwise you can’t just use to CTRL+v to paste it back in a different place.