Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

In terminal a command has a too long output. But when I scroll back I see it is truncated and only the last part is shown. In Gnome-Terminal and Konsole I have this problem. In xterm there's not such problem but I cannot copy the output in xterm.

How can I get the complete output?

share|improve this question
up vote 3 down vote accepted

I know in the xfce4-terminal there is a option to increase the number of lines shown:

enter image description here

For ubuntu Terminal enter image description here

Aside from that there is what @Zelda64fan said.

share|improve this answer
    
+1 Pipe and tee are not optimal as dont work on few cases like take in a HROOT 3NVIORTNM3NT – 22lk94k943 only Jun 1 '13 at 5:35

Save console output into a file:

  1. 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.

  2. 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 CTRLD 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

Use xclip

cat long.output | xclip -sel clip

If not installed you can do

sudo apt-get install xclip
share|improve this answer

If you don't need the entire output, you could pipe it through less: command | less. This would also save the bother of having to delete the file once you've reviewed the output.

share|improve this answer
    
less output is pretty hard to copy. – Sparhawk Mar 11 '14 at 6:41

In xterm, autocopy on select should be the default. Try triple-clicking then use a middle mouse button (or emulated third button) to paste.

The same should work with other terminals, but you need to manually copy and paste.

There a many, many ways to do this. I like using script in some cases. Type 'script' from a command line to start it before you launch a command from the command line, then hit Ctrl-D to stop. If you don't specify a capture filename, 'typescript' is the default. Everything printed to the screen should be captured in the file.

share|improve this answer

You could send the output to a file: command > file.txt (where command is the command you want to run and file.txt is the file you want to save it to) and then view it with gedit file.txt.

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.