Is there a way to persist tmux sessions across reboots?

In particular, can the tmux session data be written to a file, and reloaded on reboot?

I'm thinking of something similar to Vim's mksession command.


Solution 1:

Assuming you could save the output of all panes to a file after the fact, you still have to restore the state of all processes in those panes. There was something like that at one point but it still has quite a few limitations. There is no such built-in functionality in tmux. This isn't like Vim which just has to remember which files you opened, whether you saved your work or not, where the cursor was, the history of inputs, etc.

Edit: cryopid is down. See https://criu.org/Main_Page, which is what's officially in mainline.

Solution 2:

You can write a script manually that recreates your desired tmux configuration. https://github.com/chicks-net/chicks-home/blob/master/bin/start_tmux is an example that has saved me a lot of time. I think that's easier to maintain than something automatically built like http://brainscraps.wikia.com/wiki/Resurrecting_tmux_Sessions_After_Reboot seems to do.

Solution 3:

Check out https://github.com/tmux-plugins/tmux-resurrect - I've been using that on OSX to persist sessions between reboots.