← /writing

Persisting tmux Sessions Across Reboots

Rebuilding sessions, windows, panes, and working dirs by hand on ever restart gets old fast, enter tmux-resurrect and tmux-continuum.


Why two plugins

tmux-resurrect does the actual work. It writes your tmux state (sessions, windows, panes, layouts, working directories) to a text file and can rebuild everything from it. On its own it’s manual: prefix + Ctrl-s to save, prefix + Ctrl-r to restore.

tmux-continuum just automates resurrect. It triggers a save every 15 minutes and runs the restore when the tmux server starts fresh, like after a reboot.

Continuum is useless without resurrect, and resurrect without continuum means remembering to save before every shutdown. You want both.


Install

I use TPM. In tmux.conf:

set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

Reload the config, then prefix + I to install. Or from a shell:

~/.config/tmux/plugins/tpm/bin/install_plugins

Config

# save location (default is ~/.tmux/resurrect)
set -g @resurrect-dir '~/.config/tmux/resurrect'

# restore automatically when tmux starts
set -g @continuum-restore 'on'

# auto-save interval in minutes
set -g @continuum-save-interval '15'

# restore pane scrollback contents too
set -g @resurrect-capture-pane-contents 'on'

Without @continuum-restore 'on' continuum only auto-saves and you still have to restore manually after a reboot.


Gotcha: auto-save silently stops if status-right is set after TPM

Continuum runs its save timer by hooking into status-right. If your config sets status-right after the TPM run line, the hook gets wiped and auto-save stops. No error, nothing. Your saves just get stale.

I hit this because my theme block (status bar colors, clock in status-right) was below the TPM line. Fix: TPM init goes at the very bottom, after everything else.

# all other config, including status-right, goes above this
run '~/.config/tmux/plugins/tpm/tpm'

Verify

prefix + Ctrl-s shows “Tmux environment saved” in the status bar. Then:

ls ~/.config/tmux/resurrect/

There should be timestamped tmux_resurrect_*.txt files and a last symlink pointing at the newest one.

Heads up: the default save location is ~/.tmux/resurrect/, even if your config lives in ~/.config/tmux/. I went looking for the files next to my config and found nothing until I realized this. @resurrect-dir fixes it.


Running parallel AI agents

tmux was one of the first CLI programs I ever picked up. I didn’t expect it to become more useful over time, but in 2026 that’s exactly what happened: coding agents live in the terminal, and a terminal multiplexer turns out to be the obvious way to run a bunch of them side by side.

Which is the main reason I care about this now: I run multiple coding agents at once, Claude Code and opencode, each in its own tmux window, one per project. Usually split into a pane for the agent and a pane for a shell to check its work.

After a reboot everything comes back with each pane already in the right project directory, so resuming is just:

claude --continue    # most recent conversation in this directory
claude --resume      # pick from past sessions

opencode works the same way with opencode --continue.

With @resurrect-capture-pane-contents 'on' the agent’s last output is still in the scrollback after restore, which helps when deciding whether to continue or start over.

Don’t put the agents in @resurrect-processes though. Auto-relaunching them starts blank sessions. Let resurrect bring back the shells and directories, then resume each agent yourself.


Caveats

  • Running programs don’t come back by default, only shells and their directories. If you want specific ones relaunched:

    set -g @resurrect-processes 'ssh ncmpcpp newsboat ranger'
    
  • Restore uses the last save, which can be up to 15 minutes old. If you just rearranged everything and are about to reboot, hit prefix + Ctrl-s first.


Conclusion

Resurrect saves and restores, continuum makes it automatic. Keep the TPM line at the bottom of your config or auto-save silently breaks. Now a reboot costs me a tmux and a couple of --continues instead of twenty minutes of setup.