Development notes

Thoughts, notes and ideas about development

How to Persist tmux Sessions Across Reboots

2026-08-27 2 min read Linux

By default, tmux sessions live only as long as the tmux server is running. Reboot the machine, kill the server, or have it crash, and every window, pane and layout is gone. tmux-resurrect and tmux-continuum fix that by saving session state to disk and restoring it automatically.

Install TPM (Tmux Plugin Manager)

If you don’t have TPM yet:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

Make sure this line is at the very bottom of ~/.tmux.conf:

run '~/.tmux/plugins/tpm/tpm'

Add tmux-resurrect and tmux-continuum

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

set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'
  • tmux-resurrect does the actual saving/restoring.
  • tmux-continuum automates it — periodic saves in the background, plus a restore as soon as tmux starts.

Reload and Install the Plugins

Reload the config:

tmux source-file ~/.tmux.conf

Then install the new plugins from inside tmux: prefix + I (capital i). TPM will clone both repos into ~/.tmux/plugins/.

Manual Save and Restore

Even with continuum running, the manual bindings are worth knowing:

  • prefix + Ctrl-s — save the current session state
  • prefix + Ctrl-r — restore the last saved state

Where Sessions Are Stored

Saved state lives in ~/.tmux/resurrect/ as timestamped files, e.g. tmux_resurrect_2026-08-27T10-15-00.txt, with a last symlink always pointing to the most recent save:

ls -la ~/.tmux/resurrect/

Restoring Vim/Neovim Sessions Too

By default, resurrect restarts programs but not their internal state. To have it reopen the actual vim/nvim session (buffers, splits) instead of just relaunching the editor:

set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'

This requires a session plugin on the editor side (e.g. tpope/vim-obsession for Vim, or rmagatti/auto-session for Neovim) that actually writes the session file resurrect will read back.

Notes

  • Continuum’s auto-restore only triggers when tmux starts with no existing sessions — it won’t clobber a session you’re already in.
  • The default save interval is 15 minutes; adjust it with @continuum-save-interval (minutes).
  • Pairs well with set -g detach-on-destroy off, so panes survive a session being killed rather than tearing down the whole server.
  • Continuum won’t save what it can’t reasonably restore — shell history and environment variables inside a pane aren’t part of the snapshot, only the working directory and running command.
  • Do a manual prefix + Ctrl-s before anything risky (reboot, kernel update) — don’t rely solely on the timer.

References