9

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?

6 Answers6

12

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.

8

Use xclip

cat long.output | xclip -sel clip

If not installed you can do

sudo apt-get install xclip
Seth
  • 59,332
razpeitia
  • 181
5

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.

5

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.

2

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.

belacqua
  • 23,540
2

Save console output into a file:

  1. tee command

tee command - read from standard input and write to standard output and files.

It automatically creates file and save, all the output of cmd ps -ax into a file named as processes_info in the same folder from where the cmd has run.

user@admin:~$ ps -ax | tee processes_info
  1. script command

script command - make typescript of terminal session.

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
    
akD
  • 151