A quick Google search turns up the application xclip, and a lot of information about how Linux uses three clipboards, and they're all for different things, and.... yawn.
Anyways, with the right switches, xclip can read from STDIN and put the information into your x clipboard ready for pasting via the mouse or the keyboard shortcut. Very handy!
First I installed xclip
Code: Select all
sudo apt-get install xclip
Code: Select all
echo Hello | xclip -i -selection clipboard
Now a further test
Code: Select all
cat path/to/some/file.txt | xclip -i -selection clipboard
Now make it into a script
Code: Select all
#!/bin/bash
# cat to clipboard
#
cat $1 | xclip -i -selection clipboard
exit
Code: Select all
chmod +x clippit
Code: Select all
sudo cp ./clippit /usr/bin
Code: Select all
clippit /path/to/file
And there you have it. Happy pasting!