Skip to main content
Settings
Search
Appearance
Theme Mode
About
Jekyll v3.10.0
Environment Production
Last Build
2026-06-26 19:04 UTC
Current Environment Production
Build Time Jun 26, 19:04
Jekyll v3.10.0
Build env (JEKYLL_ENV) production
Quick Links
Page Location
Page Info
Layout article
Collection hacks
Path _hacks/tmux-survive-a-reboot.md
URL /hacks/tmux-survive-a-reboot/
Date 2026-06-25
Theme Skin
SVG Backgrounds
Layer Opacity
0.6
0.04
0.08

Make tmux survive a reboot, not just a disconnect

The survival subset sells one feature hard: a tmux session outlives the terminal. Lose the wifi, close the lid, reboot your router — tmux a and you’re back.

It sells that feature because it’s true, right up to the word reboot. Reboot the machine tmux is running on — a kernel update, a crash, a sudo reboot you ran in the wrong window — and the tmux server dies with everything else. The session lives in that server’s memory. No memory, no session. tmux ls after a restart tells you the bad news flatly:

no server running on /tmp/tmux-1001/default

That’s the gap. tmux survives a disconnect for free; surviving a restart takes two plugins and a clear head about what they can and can’t put back.

What we’re actually buying

Two plugins from the tmux-plugins ecosystem (the same community org that maintains TPM, the plugin manager we’ll install first):

  • tmux-resurrect writes your current sessions, windows, panes, layout, and each pane’s working directory to a plain text file — and restores them on demand.
  • tmux-continuum runs resurrect’s save on a timer and, optionally, restores the last save automatically when a fresh tmux server starts. So after a reboot, the first tmux you launch quietly rebuilds yesterday.

Set expectations now, because this is the honest part the plugin pages bury: resurrect restores the shape of your work — which windows, which splits, which directories. It does not restore the processes that were running in them. We’ll prove that at the end, because it’s the thing that’ll bite you if nobody says it out loud.

Step 1: get a plugin manager

Resurrect and continuum install through TPM, the Tmux Plugin Manager. One clone:

```bash lh:norun git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm


You'll know it worked when the directory exists:

```console
$ ls ~/.tmux/plugins/
tpm

Step 2: add the plugins to your config

Pick up the ~/.tmux.conf from the survival subset and add a reboot-survival block to it. The whole file now looks like this:

# --- the survival subset (every line earns its place) ---
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g mouse on
set -g base-index 1
setw -g pane-base-index 1
bind | split-window -h
bind - split-window -v
bind r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
set -g history-limit 10000

# --- the reboot-survival layer ---
# Save the scrollback too, not just the layout
set -g @resurrect-capture-pane-contents 'on'
# Restore the last save automatically when tmux starts after a reboot
set -g @continuum-restore 'on'
# Autosave every 15 minutes (this is also the default)
set -g @continuum-save-interval '15'

# Plugins (keep this list last)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# Initialize TPM — must be the very last line
run '~/.tmux/plugins/tpm/tpm'

Two things people get wrong here. The run '...tpm/tpm' line must be last — anything below it never loads. And @continuum-restore is off by default; the 'on' above is the line that does the actual reboot magic. Without it, continuum still autosaves but never restores, and you’ll wonder why nothing came back.

Step 3: install the plugins

Reload the config, then tell TPM to fetch what you listed. Inside tmux, that’s prefix I (capital i). From a shell it’s one command:

```bash lh:norun tmux source-file ~/.tmux.conf ~/.tmux/plugins/tpm/bin/install_plugins


You'll know it worked when both plugin directories are present:

```console
$ ls ~/.tmux/plugins/
tmux-continuum  tmux-resurrect  tpm

Step 4: prove the save actually saves

Don’t take the autosave on faith — fire it by hand once and read the file it writes. Inside tmux the manual save is prefix Ctrl-s. We ran the same thing resurrect’s keybinding runs, against a real session with two windows and a split:

$ tmux list-windows -t work
1: editor- (2 panes) [80x24] [layout 8205,80x24,0,0{40x24,0,0,0,39x24,41,0,1}] @0
2: server* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @1 (active)

After prefix Ctrl-s, resurrect drops a timestamped text file and points a last symlink at it:

$ ls ~/.local/share/tmux/resurrect/
last -> tmux_resurrect_20260625T155802.txt
pane_contents.tar.gz
tmux_resurrect_20260625T155802.txt

And that file is refreshingly readable — one line per pane and window, tab-separated, your working directories right there in plain text:

$ cat ~/.local/share/tmux/resurrect/last
pane	work	1	0	:-	1	host	:/tmp	0	bash	:
pane	work	1	0	:-	2	host	:/home/runner	1	bash	:
pane	work	2	1	:*	1	host	:/var/log	1	bash	:
window	work	1	:editor	0	:-	8205,80x24,0,0{40x24,0,0,0,39x24,41,0,1}	off
window	work	2	:server	1	:*	b25f,80x24,0,0,2	off
state

That’s the whole insurance policy: three panes, their directories (/tmp, /home/runner, /var/log), and the exact split geometry, in a file no reboot can touch.

Step 5: the actual reboot test

A real reboot is hard to stage politely, so we staged the part that matters — we killed the entire tmux server, which is exactly what a reboot does to it:

$ tmux kill-server
$ tmux ls
no server running on /tmp/tmux-1001/default

Everything is gone. Now restore. Inside tmux the key is prefix Ctrl-r; with @continuum-restore 'on' it also happens by itself the next time a tmux server starts. Either way, the layout walks back in:

$ tmux list-windows -t work
1: editor* (2 panes) [80x24]
2: server  (1 panes) [80x24]

Both windows. The two-pane split in editor. And the directories came back with them:

$ tmux list-panes -t work:editor -F 'editor.#{pane_index}  cwd=#{pane_current_path}'
editor.1  cwd=/tmp
editor.2  cwd=/home/runner

From a clean, server-is-dead state to your full workspace shape, with every pane already cd‘d to where it was. That’s the win, and it’s a real one.

The part where it breaks

Here is the sentence the plugin readmes should open with and don’t. Look at what’s running in those restored panes:

$ tmux list-panes -t work:editor -F 'editor.#{pane_index}  cmd=#{pane_current_command}'
editor.1  bash
editor.2  bash

bash. Just bash. Before the reboot, pane 1 might have had Vim open on a file and pane 2 a dev server pinned at 30% CPU. After restore, both are a fresh shell sitting in the right directory. resurrect brought back the room — the walls, the desk, which folder the desk was in. It did not bring back the work on the desk. The processes died with the server, and no text file can resurrect a running program.

This matters most for the things you’d most want back: a running server, a tail -f on logs, an editor with unsaved buffers. Those do not return. You land in the right directory with a clean prompt and have to relaunch them yourself.

resurrect can be taught to re-run specific programs on restore — there’s a @resurrect-processes option where you list commands like vim or ssh to relaunch. We’re deliberately not pasting an untested config for it, because the failure mode is nasty: tell it to restore a process that takes arguments or a confirmation prompt and you get a pane that hangs or errors on every reboot. If you want it, add one program at a time and reboot-test each — don’t copy a big list off a gist and trust it.

The honest accounting

What you actually bought, stated plainly:

  • Comes back: sessions, windows, panes, the split layout, each pane’s working directory, and (with capture-pane on) the scrollback text.
  • Does not come back: the processes. Every pane restores as a bare shell in the right place.

That’s a smaller promise than “restore my session,” and it’s still worth the two-plugin setup. Re-cd-ing into six directories across four windows is the tedious part of rebuilding after a reboot; relaunching a server you were about to restart anyway is not. Continuum saves every 15 minutes in the background, restores on the next launch, and the worst case is you’re back to a familiar layout typing the same three commands you’d have typed regardless.

It won’t “10x” your recovery. It turns “where was I and what was open” into “everything’s where I left it, now I only restart the server.” Set it up before the reboot you didn’t plan, because that’s the only kind there is.