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 executed commands in the terminal and there are outputs shown in the terminal. I want to select all the screen shown. How to achieve that ?

share|improve this question
Is selecting it with the mouse and copying (Ctrl-Shift-C) not an option? – slhck Nov 14 '11 at 12:05
Ok , it's right ! make it as an answer so that I can remember it and so you can gain in scoring – Andy Frédéric ANDRIANIAINA Nov 14 '11 at 12:09
up vote 7 down vote accepted

There are 2 options,

  1. Either you can copy-paste the selected text using Ctrl + Shift + C and Ctrl + Shift + V in which you have freedom what things to copy OR
  2. Redirect the text to a file using redirection

    program1 >outputfile.txt 2>errorfile.txt

    here, all the stdout will go to outputfile.txt while all the stderr will go to errorfile.txt.

P.S. from the comments below,

  1. Select the text to be pasted, and use mouse middle button (scroll wheel button) to paste it at desired place.
share|improve this answer
There's also the buffer. In most terminal emulators I've used, if you copy over some text, you can paste it elsewhere with a click of the scroll wheel. – Rob Nov 14 '11 at 15:30
@Rob: not only in terminals, anywhere. This trick is little known, even by some old time Linux users. – m0skit0 Nov 14 '11 at 17:35
I could've sworn it wasn't working properly in my browser, don't have my netbook with me to check. – Rob Nov 14 '11 at 17:45


A) "tee" command
user@admin:~ $ ps -ax >> processes_info
Saves, all the output of cmd "ps -ax" into a file named as "processes_info" in "tmp" folder. It automatically creates the file "processes_info"

user@admin:~$ ps -ax | tee processes_info
It's do the same as above but "tee" cmd also display the output on the console simultaneously.

B) "script" command
user@admin:~$ script my_console_output.txt
This creates a file named as "my_console_output.txt" and will open a subshell and records all information through this session. After this, script get started and whatever the console output, it will get stored in the file "my_console_output.txt";

unless and until the script ends when the forked shell exits. (e.g., when the user types "exit" or when "CTRL-D" is typed.)

user@admin:~$ script -c "ps ax" processes_info.txt
- it starts the script; - creates the file "processes_info.txt"; - stores the console output into the file; - end (close) the script.

Other example: script -c 'echo "Hello, World!"' hello.txt

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .