Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be able to run a command in my Terminal, and then quickly be able to copy the contents of the output into my clipboard without leaving my keyboard. Is there any way to do this?

share|improve this question

migrated from May 13 '13 at 7:52

This question came from our site for professional and enthusiast programmers.

No terminal emulator I know of let save the output from commands in the clipboard just using the keyboard.

An useful tool for the purpose could be xclip. You can use it like this:

  • paste with middle mouse button:

    $ some_command | xclip
  • paste with Ctrl-V

    $ some_command | xclip -selection clipboard
share|improve this answer
fos OS X use pbcopy instead of xclip – kobame May 10 '13 at 19:50
Anyway to do this after the command has already been run though? Not sure if that's important to the OP. – Clayton Stanley May 12 '13 at 4:24

See this question: Copy current command at bash prompt to clipboard

It explains how to use the bind command for copying the last command into the clipboard.

share|improve this answer
He doesn't want the command, he wants the contents of the output. – Clayton Stanley May 12 '13 at 4:22
The question seems to have been edited for a different purpose than what I originally tried to answer. – Cameron Tinker May 13 '13 at 4:35

You must log in to answer this question.