Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer
    
xsel is similar to xclip and can be used similarly. –  alfplayer Dec 14 '09 at 23:19
    
Simply calling xclip doesn't do it by default, but if you append it with the following options the -sel clip or -selection clipboard it you can paste the output to your browser etc.. echo "http://superuser.com/" | xclip -sel clip, alt-tab to chrome, ctrl+l, ctrl+v, enter... vola! P.S. I don't know if xsel has similar options to make it work. By default it doesn't work. –  Timo Lehto Aug 15 '12 at 9:45

You can also just mark the terminal output you want to copy and it is copied to your clipboard automatically.

share|improve this answer
    
Technically it's called the cut buffer, the clipboard is something else. –  TRS-80 Jan 14 '10 at 2:55

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.