How to copy all output on xfce-terminal of gnome-terminal?

Solution 1:

Sadly I think the only really efficient/reliable solution would be to patch the pseudo-terminal code itself to do this. I've been looking for a way to do this in xfce for a while, and the cleanest answer I have at this point is: use the mouse to copy the whole buffer top to bottom, then run this:

$ xclip -selection c -o > ~/output-of-pseudo-terminal

What I really want is something that will ALWAYS log ALL my terminal output. To me, RAM and disk space are cheap, and realistically even when I accidentally hit all those stupid commands that flood the screen, a year's worth of my work on the terminal is still mere megabytes and the benefits of logging it all are many compared to how trivial it would be.

Also, while I think a patch to automatically save output is ideal, perhaps an easier workaround patch could be a command for automatically "selecting all" text and copying it - that way it could at least be combined with xclip and cron-scripted, etc. and not force us to be clumsy with the mouse :)

Solution 2:

Instead of dragging mouse to select all text, I got a workable way though I not so like it.

  1. triple click the last line of current terminal(do not release the mouse).
  2. press SHIFT+HOME key which will lead us to the first line.
  3. drag mouse to the first line.
  4. right click , edit->copy.

Solution 3:

Redirect it to a file:

$ example-command > ~/output.txt

Where example-command is the command that is producing the output you want to save. The tilde (~) signifies your home directory, so the file output.txt will be under your home folder containing the output of the command.

If you want all output, including errors:

$ example-command > ~/output.txt 2>&1

If you'd like it on your clipboard, you have a few options:

If there isn't a lot of output, you can highlight the output and right click to save it to your clipboard. If there is too much to highlight, pipe it to xclip (you may need to install it depending on your distro):

$ example-command | xclip

xclip allows command line interaction with the X server's clipboard.