Read iTerm2 last session output history

itermssh

This is probably a long shot but it would be really handy if there is a solution. I am logged in on a work computer I currently cannot access. I know the output of a long running job I previously started is on an iTerm2 window.

I have SSH access to the machine and I would like to read the contents of that window. Is there, e.g., a file where iTerm2 backs up session output? Or any other way to read the content of an open window? Obviously it's too late to select any specific session logging options. Usually after a forced restart, the iTerm2 window will restore the previous output so I presume it is saved somewhere.

Best Answer

This was discussed some time ago on Unix.SE and the bottom line is that there is no general way of doing that, unless you

  • want to search for that data in the memory of the terminal process
  • you want a terminal that support querying for the buffers (some says xterm knows that)
  • You have your commands running in screen/tmux

I would not like to discourage you nor any other possible answerers. Maybe there is some Apple-specific way I don't know about.