I needed to upload the contents of a lengthy log file to a site earlier today. There was no option to simply attach the file. I was instead asked to just paste its contents. I suppose that I could have opened the file in an editor like Kate and copied its contents to the clipboard. But I became curious as to the possibility of accomplishing this from within the terminal. A little googling revealed the existence of a utility named xsel for this very purpose.
The utility will first need to be installed:
sudo apt-get install xsel
(on my Debian-based distro)
Once this is one, copying the contents of the file to the clipboard is as simple as:
cat myfile.log | xsel
The file is now in the (X) clipboard/buffer and can be pasted in the browser by way of a mouse middle-click or an equivalent command.
Nifty and I hope that you like it!
- Log in to post comments