There are, of course, many ways to save terminal output to a file. However, all the ones I know of require you execute them before the commands who's output you want to save. Is there a command for saving terminal output that's already in the terminal?
You may want to change your problem by using a terminal multiplexer like screen or tmux. With tmux you can save a selected text from the buffer with the following key command.
- Ctrl+B, [
- move to the start of the selection you want to save
- move to the end of selection
You can then paste the content of the selection with Ctrl+B,], in a text editor for example.
screen has the Ctrl+A,H to copy the current content of the window in a file named
This can be dependent on the terminal you’re using and if you’re using a GUI at all. if you are then the easiest and most common way would be to
- triple-click the last line
- press shifthome or
- press shiftclick first line
- Then either right click copy or CtrlShiftc or right click the top bar of your terminal click Edit-copy (can also select all from there) and
Command line tools for this would be
But again this is depending on your distro.
If you could provide some more info I could be more specific with a solution