Take the Full Control of Flooded Screen in iTerm2

If you are using a terminal emulator in macOS, time to time you need to go back in the history of the things shown on the screen. A specific example is when flashing screens don’t leave any trace in the scroll history, e.g. top command. Luckily there is a way to access this history in iTerm2, which is a powerful alternative to the default terminal emulator in macOS. If you don’t use iTerm2 I strongly suggest using it and learning its details. Let’s see how it works:

Going back in time in iTerm2 is magically possible*

The functionality to capture the history of the screen display is called Instant Replay in iTerm2. It give you the ability of going back in time as much as memory is allowed. Instant Replay is enabled by pressing Cmd+Opt+B. Once you are in the instant replay mode, you can use take the time to wherever on the timeline by mouse or left/right arrow keys.

By default, 4MB is the upper limit set for the instant replay history, but you can set it according to your needs. You can adjust the memory limit under Preferences > General > "Instant Replay uses X MB per session".

As I wrote above, “top” is an example of the need of capturing history. Another example is seeing the things that are cleaned if you are using “clear” (shortcut is Cmd+K) command often like I do. You can see how it works in the video below.

* Image Source