This: Save all the terminal output to a file

Except after the fact. Meaning that instead of preparing to record or pipe all output to a file, I am dealing with output that has already taken place, and that I omitted to record to a file. Rather than to spend minutes scrolling up 7000 lines of output, copying and pasting that to a document, I have to think there is an easier way to get the current output.

Considering that this may depend upon the terminal emulator, I am using Konsole and zsh in this case.

How can I save the terminal output to a file after the fact?

2 Answers 2


With konsole, File->Save output as works as does CTRL-SHIFT-S, but you will only save what is in the buffer.

  • 2
    +1. tmux can also do this, in any terminal emulator. see Write all tmux scrollback to a file. note, though, that if you're running tmux on a remote host (e.g. via ssh) then the buffer will be saved on the remote host, not on the local machine you're running your terminal emulator on.
    – cas
    Oct 16, 2021 at 14:03

I use script for this matter. It's easy, simple, and out of the box.

  • First invoke script in your terminal:
# script output.txt
Script started, file is output.txt
  • Start running your commands normally.

  • Once you decided to get your commands and all the outputs, run exit:

# exit
Script done, file is output.txt
  • All your outputs will be in output.txt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.