Skip to main content

tmux-resurrect — Session Persistence

Saves and restores the complete tmux environment: sessions, windows, panes, layouts, running commands, and pane contents.

Status on This Server

Installed and active. Configured in ~/.tmux.conf.

Key Bindings

Default ShortcutModification ShortcutAction
Ctrl+b Ctrl+sCtrl+Space Ctrl+sSave current session state
Ctrl+b Ctrl+rCtrl+Space Ctrl+rRestore last saved state

Configuration

~/.tmux.conf
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-dir "$HOME/.local/share/tmux/resurrect"
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'yazi opencode ssh btop visidata python3'
OptionValuePurpose
@resurrect-dir~/.local/share/tmux/resurrectWhere backup files are stored
@resurrect-capture-pane-contentsonAlso saves visible pane text
@resurrect-processesyazi opencode ssh btop visidata python3Which programs to restore

Backup Location

Files are saved to ~/.local/share/tmux/resurrect/ with the naming pattern:

tmux_resurrect_<timestamp>.txt

The last symlink in that directory always points to the most recent backup.

Restore Workflow

After a reboot or crash:

  1. Open any tmux session
  2. Press Ctrl+Space Ctrl+r
  3. All sessions, windows, and panes are restored (including configured programs)

Post-Save Hook

This server has a custom hook that copies every save to a dated directory under common-config for git tracking:

~/github/common-config/tmux/gc-sg-m16/continuum/<date>/

Backups older than 60 days are automatically cleaned up.