Say I've typed the following long command into the command line
$ some very long command that I want to copy to the clipboard
How can I get this onto the system clipboard efficiently?
I'm using Gnome Terminal 2.23.1.
I know that I can get the mouse and highlight it and copy it, but I want a general keyboard solution.
It would also be good if it generalised to multiple command-line programs.
For example, in bash in vi mode, I can press v
and then edit the command in vim, and thus use Vim's copy to clipboard features, but this doesn't work when using R on the command-line. It's also a bit slow.
I'd like it if in vi-mode, I could press yy
and copy the contents of the line to the system clipboard, but this doesn't seem to work. Furthermore any yanking commands don't seem to copy contents to the system clipboard; they appear to only copy to a buffer used by bash.
UPDATE:
After posting I found
Best Answer
You could also use a clipboard manager like
parcellite
. It's a GTK+ clipboard manager which also has command-line clipboard capabilitiesYou can use it via command-line by
It is not installed by default and so you'll have to install parcellite by
sudo apt-get install parcellite