One of the cool things about tmux is that, even if you close the terminal that tmux runs in, the tmux server process keeps your session around. That also means that you can reconnect to it from another terminal.
If you accidentally or purposely closed a terminal session that was running tmux, you can simply launch a new terminal instance and list your existing tmux sessions with:
You might get a list of the sort:
git: 2 windows (created Tue Oct 4 09:30:12 2022) (attached) projects: 6 windows (created Tue Oct 4 09:30:44 2022) (attached)
Now to connect to any of the existing session simply use:
tmux attach -t <session_name>
For example to reconnect to the
projects tmux session use:
tmux attach -t projects
And you’re back to where you left of!
There’s even a way to Reconnect to Broken tmux Session