Tuesday, October 12, 2010

xlcip or How to copy past from the command line to x-windows

Brain Ashburn, my colleague in the Atlanta Red Hat office, introduced me to the xclip utility today. It copies output from the command line and puts it into x-windows.

For example, to copy the current directory :
 pwd | xclip -i -sel "clip"

There are of course more useful things that can be piped to it. To try it out create a file, add some text and :
cat newfile | xclip -i -sel "clip"

Its available through yum :
sudo yum install xclip

1 comment:

Brian Ashburn said...

pwd | tr -d "\n" | xclip -i -sel "clip" will trim the line that comes at the end of the command.