DEV Community

Dang Hoang Nhu Nguyen
Dang Hoang Nhu Nguyen

Posted on

3 2

[BTY] Day 12: Auto resurrecting tmux sessions

Tmux is great, except when you have to restart the computer. You lose all the running programs, working directories, pane layouts etc.

tmux-resurrect is a tool to persist a tmux environment across system restarts.

But, you have to manually save an entire tmux session or restore the session.

tmux-continuum comes as a cure because it continuously saves your tmux environment at regular intervals and automatically restores it when tmux is started.

Checkout here: https://github.com/tmux-plugins/tmux-continuum

# In ~/.tmux.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# https://github.com/tmux-plugins/tmux-continuum/issues/48#issuecomment-527336993
set -g @continuum-save-interval '15'

# Option to display current status of tmux continuum in tmux status line. 
set -g status-right 'Continuum status: #{continuum_status}'

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

# Restart / reload TMUX env using : Prefix + I or "tmux source ~/.tmux.conf"
Enter fullscreen mode Exit fullscreen mode

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay