screen can do this. Connect to a
screen instance, run your shell commands, and get a "hardcopy" of the current terminal with the
hardcopy screen command (type Ctrl-A, then press "h"). The output is usually saved in your home directory in
If you need more than what's on the current screen, use
screen's scrollback buffer.
- Access it (get into "copy mode") by pressing Ctrl-A, then Esc.
- Scroll up/down with Ctrl-U/Ctrl-D or the arrow keys or vim-style movement (j/k/l/h).
- Get out of "copy mode" by pressing Esc.
Using "copy mode", you can select a block of text and get a hardcopy like this:
- Get into "copy mode" (press Ctrl-A, then Esc).
- Scroll to the start of the text you want to copy.
- Press SPACE. This marks the start.
- Scroll to the end of the text you want to copy.
- Press SPACE again. This fills the copy buffer and exits out "copy mode".
- Write the copy buffer to file (press Ctrl-A, then
>). The copy buffer is written out to
/tmp/screen-exchange to whatever file you like:
cp /tmp/screen-exchange ~/my.terminal.printout.txt
Your terminal's output is now in