Or there any other way to do it? Googling brings up nothing ( I tried for years ).

If you don't what iterm2 means by "instant replay": https://www.iterm2.com/features.html - basically like desktop video capturing, only in text - so the user can copy-paste from the captured history

--edit-- An example for clarification: I edit a file in vim ; close vim ; accidentally delete the file ; I start "instant replay" and find what the terminal emulator looked like when I was editing the file.

  • probably not (it's not the same as scrollback, which will be what most people propose as answer). Oct 2, 2016 at 19:39
  • Actually, mlterm ( sourceforge.net/projects/mlterm ) offers the ability to have history be recorded in ttyrec format which does allow you to play-back sessions with copy/paste intact.
    – HalosGhost
    Oct 3, 2016 at 0:28

3 Answers 3


You did not found anything because it should be implemented not in the terminal emulator, but in shell itself. I think a simple script command is what you need. Read man script


I don't know of a terminal emulator that has this built in. But following the Unix philosophy, let the terminal emulator do the terminal emulator, and use a separate tool to do the recording and replay. You can use script to record the output as streams, or ttyrec to record timings as well (the Wikipedia page links to several players for recordings with various degrees of sophistication, including IPBT which is good for finding things that were only displayed for a very short time). There are fewer tools that record the input; one such is ttyrec2.


You might find that https://asciinema.org/ is a more useful option than script as it records the session as a terminal window rather than a raw stream of characters that comprise the terminal session.

It doesn't appear to have the replay option you're seeking, but it does allow you to replay the session in another window, pause it at the critical moment, and copy'n'paste from that recording back to the original terminal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .