Accessing closed terminal tabs with session restoration

15 views
Skip to first unread message

Aaron Meurer

unread,
May 29, 2024, 2:32:25 AMMay 29
to iterm2-...@googlegroups.com
With session restoration enabled, iTerm2 keeps old terminal tabs alive
even if the tab is closed. However, is there any way to actually
access these old tabs once they are closed? When I open a new tab, it
creates a new session. I can see the processes for these old tabs in
ps aux (I can tell they are old tabs from their tty number). I can
also manually kill them with kill, but it would be nice if iTerm2
provided some way to access and/or kill them. Maybe it could reuse the
UI for buried sessions, or something similar.

Aaron Meurer

George Nachman

unread,
May 29, 2024, 12:25:57 PMMay 29
to iterm2-...@googlegroups.com
You can undo closing a session/tab/window with Edit > Undo.
Probably there should be a menu item just for this because it is hard to discover.

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/CAKgW%3D6KxVORtYXZONb3n%3DeP8%2BpHnnTJKFu_onW4J-CWz3k-5Ug%40mail.gmail.com.

George Nachman

unread,
May 29, 2024, 12:27:07 PMMay 29
to iterm2-...@googlegroups.com
Apparently I had this thought before because there is also File > Undo Close

Aaron Meurer

unread,
May 30, 2024, 11:11:41 PMMay 30
to iterm2-...@googlegroups.com
That's good to know, but it doesn't really solve my problem in all
cases. Sometimes I'll discover that some tab I closed some time ago is
still running a process. Actually I rarely "close" terminal tabs so
usually when this happens it's because iTerm2 crashed or something and
couldn't restore the session state.

TBH this sort of behavior is pretty surprising (though I guess it's
not enabled by default?). I would normally expect closing a tab to
kill the process running in it.

Aaron Meurer
> To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/CAB5Rqon%2BNm0ePUHqwzezYS5Gt7FasyNyU5G37scHKP3Mu0E3cw%40mail.gmail.com.

George Nachman

unread,
May 31, 2024, 10:23:46 PMMay 31
to iterm2-...@googlegroups.com
If it doesn’t kill it after the timeout set in Settings>Profiles>Session then that’s a bug. If you can reproduce it, a debug log would be amazing.

Aaron Meurer

unread,
Jun 1, 2024, 5:42:36 PMJun 1
to iterm2-...@googlegroups.com
Is this a new feature? Mine is apparently set to 5 seconds. I actually
haven't seen this happen in a while (I meant to send this message a
while ago when the mailing list was flagged for spam), but when it did
happen the processes were definitely alive for more than 5 seconds. I
just tested it with a normal close operation and it does seem to work.
Like I said, though, when I saw it the issue was from old tabs that
Term2 wasn't able to restore properly after an update.

Aaron Meurer
> To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/CAB5RqonYX0Z_2YB520grkE-XFpWtGYs-k5L3LMKPkG%3DmJJ-_2w%40mail.gmail.com.

George Nachman

unread,
Jun 2, 2024, 10:57:59 PMJun 2
to iterm2-...@googlegroups.com
The delay before killing closed sessions/undo close feature have been around for about 9 years. If you have reproduction steps I could follow where a shell lives longer than the 5 second timeout please let me know!

Reply all
Reply to author
Forward
0 new messages