# xsel and you

As a technology worker, I live in  web-based ticketing systems. As such, you generally get some data, such as a command or list of hosts, you need to work with in a shell.

For may years my work flow was:

1. highlight whatever it is in the ticket
2. Crtl-C
3. switch over to my terminal
4. open a txt file
5. Shft-Ctrl-V
6. save file
7. parse file.

This is where xsel shines.  xsel is a wonderful tool for storing and retrieving data on the command line.

For example:

# xsel -b

is used for pasting AND copying to the system clipboard. This allows you to things like

# xsel -b | awk '{print \$1}' |xsel -b

on a column of hostnames and, say, their description you Ctrl-C from a ticket.

Cooler still, in Ubuntu, you can eliminate the Crtl-C part and just manipulate what you’ve highlighting with bare xsel.

There are a few tools for manipulating clipboards for different OSes. xsel and xclip and prominent in the Linux space. I believe pbcopy/pbpaste are for OSX.