After clearing a Mac terminal (via Command K, or the "Clear All" command under the edit menu), is there a way to easily restore the previously cleared text?
Periodically, when I run a long process on a Mac Terminal (such as a suite of unit tests) I prefer to clear the terminal. I do this so when I'm scrolling up to look over the results of the process, I can focus ONLY on the results of that process and not other commands I've recently run. (Such as, say, a different suite of tests)
But, sometimes I do eventually want to go back and look over the previous suit of tests.
Is there a way to restore previous terminal text?
The terminal is not going to help with restoring the text. It is gone.
If you anticipate wanting to review the text, you could (in a more or less transparent manner—not interfering with your work) run your session in script
. That records everything sent to the terminal (including escape sequences for vi).
If your use of the terminal is largely just cat
'ing files or watching logs, then the resulting typescript
file is usable with less -R
. It does not work well with cursor-movement, but for those, I use slowcat
or similar filters to slowly cat
a file, etc. For best results, the terminal emulator interprets escape sequences reliably.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With