Skip to content

Guide · Open source

How to use tmux-resurrect: save and restore tmux sessions

Updated · written with AI from the project's own documentation and checked against our catalogue data

tmux-resurrect is a tmux plugin that saves the details of your tmux environment, such as sessions, windows, panes, working directories and layouts, so you can restore them after a system restart or whenever you choose. This guide is for people who keep several tmux sessions open and do not want to rebuild them by hand. By the end you will know how to install the plugin, save your environment, restore it and check what it covers.

tmux-resurrecttmux-plugins/tmux-resurrect · ★ 13.1k · MIT

Quick start

  1. 1Check the prerequisites. Confirm you have tmux 1.9 or higher and bash installed.
  2. 2Add the plugin to .tmux.conf. Add the TPM line set -g @plugin 'tmux-plugins/tmux-resurrect' to your config file.
  3. 3Install with TPM. Press prefix + I inside tmux to fetch and source the plugin.
  4. 4Save your environment. Press prefix + Ctrl-s before you shut down or restart.
  5. 5Restore after restart. Start tmux and press prefix + Ctrl-r to restore sessions, windows, panes and layouts.

What tmux-resurrect does and what it saves

tmux keeps programs running in panes and windows, but a computer restart ends those programs and loses the layout. tmux-resurrect saves the details of your tmux setup so it can be rebuilt later.

According to the README, the plugin saves all sessions, windows, panes and their order, the current working directory of each pane, and the exact pane layouts within windows, even when zoomed. It also records the active and alternative session and window, the window with focus, and the active pane in each window. Grouped sessions, which are useful when using tmux with multiple monitors, are included too.

  • All sessions, windows, panes and their order
  • Current working directory for each pane
  • Exact pane layouts within windows (even when zoomed)
  • Active and alternative session, and active and alternative window for each session
  • Grouped sessions
  • Programs running within a pane, with details in the restoring programs doc

Install tmux-resurrect with Tmux Plugin Manager

The README recommends installing through Tmux Plugin Manager (TPM). The prerequisites are tmux 1.9 or higher and bash. Add the plugin to the list of TPM plugins in your .tmux.conf file.

After saving the file, press prefix + I to fetch the plugin and source it. Once that finishes you can use the plugin.

  • Requirements: tmux 1.9 or higher, and bash
  • Plugin Manager install is recommended but optional
set -g @plugin 'tmux-plugins/tmux-resurrect'

Install tmux-resurrect manually

If you do not use TPM, clone the repository to a path of your choice. The README uses ~/clone/path as the example location.

Then add the load line to the bottom of .tmux.conf and reload tmux with the source-file command. You should then be able to use the plugin.

git clone https://github.com/tmux-plugins/tmux-resurrect ~/clone/path run-shell ~/clone/path/resurrect.tmux tmux source-file ~/.tmux.conf

Save and restore your tmux environment

The default key bindings are prefix + Ctrl-s to save and prefix + Ctrl-r to restore. Save before you shut down or restart the computer, then restore after tmux starts again.

The README notes that restore is idempotent: it will not try to restore panes or windows that already exist. The one exception is when tmux starts with only one pane, in which case that pane is overwritten by the saved environment.

  • Save: prefix + Ctrl-s
  • Restore: prefix + Ctrl-r
  • Restore does not recreate panes or windows that already exist

Know the limits and optional features

Only a conservative list of programs is restored by default: vi, vim, nvim, emacs, man, less, more, tail, top, htop, irssi, weechat and mutt. The restoring programs doc explains how to add others.

Vim and Neovim session restore and restoring pane contents are optional features, documented separately. The README does not promise automatic saving or restoring on a schedule. For that, it points to the separate tmux-continuum plugin.

The README says the plugin has been tested and works on Linux, OSX and Cygwin.

  • Default restored programs: vi vim nvim emacs man less more tail top htop irssi weechat mutt
  • Optional: restoring vim and neovim sessions
  • Optional: restoring pane contents
  • Automatic restore and continuous saving: use tmux-continuum

Customise the key bindings and save location

The README lists docs for changing the default key bindings, setting up hooks on save and restore, and changing the directory where tmux-resurrect saves the environment. Each has its own page linked from the README.

  • Changing the default key bindings
  • Setting up hooks on save and restore
  • Changing the save directory

What people use it for

  • Rebuilding a set of tmux sessions with their panes and working directories after a reboot
  • Keeping a multi-monitor setup with grouped sessions intact across restarts
  • Bringing back a Vim or Neovim editing session in a pane, if you enable the optional feature
  • Restoring the exact zoomed or split pane layout you were using before a restart

Frequently asked questions

Is tmux-resurrect free?

tmux-resurrect is released under the MIT licence, as stated in the README. The licence file is linked from the project page.

What do I need to run tmux-resurrect?

The README lists tmux 1.9 or higher and bash as requirements. It is tested on Linux, OSX and Cygwin.

How do I install tmux-resurrect?

Add set -g @plugin 'tmux-plugins/tmux-resurrect' to .tmux.conf and press prefix + I with Tmux Plugin Manager, or clone the repository and add run-shell ~/clone/path/resurrect.tmux to .tmux.conf for a manual install.

Does tmux-resurrect restore automatically after a reboot?

Not by itself. The README says automatic restoring and continuous saving are available through the separate tmux-continuum plugin.

Does tmux-resurrect work on Windows?

The README only lists Linux, OSX and Cygwin as tested. It does not claim support for native Windows outside Cygwin.

What is the alternative to tmux-resurrect?

The README mentions tmux-continuum for automatic saving and restoring. Other projects in the same space include tmuxinator, which the README references in its migration guide, and tmuxp.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

tmux-resurrect suits terminal users who keep many tmux sessions open and want to restore them after a reboot without writing a configuration file. It is a poor fit if you do not use tmux, need automatic scheduled restore (use tmux-continuum), or work on Windows outside Cygwin.

Install options & downloads