How to efficiently send text entered on the command line to the system clipboard without using the mouse?
Solution 1:
You could also use a clipboard manager like parcellite
. It's a GTK+ clipboard manager which also has command-line clipboard capabilities
You can use it via command-line by
echo "some very long command that I want to copy to the clipboard" | parcellite
##or##
parcellite "some very long command that I want to copy to the clipboard"
It is not installed by default and so you'll have to install parcellite by sudo apt-get install parcellite
Solution 2:
So the closes I have be able to get is by using the history and xclip in conjunction doing this
echo !! | xclip
This will put the last command on the the center button clipboard. I am still searching for something better though as I would like to get it down to one command. However I get hung up because history doesn't function in shell scripts and I don't know that there is a way to use !!
properly in an alias. Of course this doesn't appear to be quite what your asking for my intention is to use this for taking notes of what I am doing. Any thoughs?