How to copy an output on a GNOME terminal to clipboard from command line.
I'd like to be able to paste text from my console textfiles smoothly to Firefox.
You can highlight the text then right click and select copy, or pipe it to xclip:
some-command | xclip
xclip may or may not be available depending on your distribution.
You can also just mark the terminal output you want to copy and it is copied to your clipboard automatically.
It's an old question but I thought it deserves a working answer. Either xsel or xclip can do this job. Personally I prefer to use
Then change to some app and do a paste (with CTRL-V, the paste option, etc.).
What if you are doing the opposite, and copy some text in your browser and want to paste it into your terminal? (Well, of course you can just paste.) Or type:
X has got 3 different selections or clipboards. The "primary" one is the one that activates with the middle mouse button. That's what you get if you call
I recommend you do use the
If you prefer to use
After selecting the text, press Ctrl-Shift-C to copy it to the clipboard. The extra Shift is required as Ctrl-Cis already used in shells. Similarly, to paste, press Ctrl-Shift-V.
You can also just select it then middle-click in Firefox to paste it. This uses the cut buffer, which is slightly different to the clibpoard.
Bonus gnome-terminal tip - Ctrl-click a url to automatically open it in your default browser.