Work Flow
-
Persist tmux status automatically or manually;
-
After restarting the computer, all sessions, windows and panes can comes back.
Solution
First make sure your tmux version >= 1.9 with tmux -V
. If not, run:
```
proxychains wget https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
tar zxf tmux-2.3.tar.gz
cd tmux-2.3
./configure && make
sudo apt-get install libevent-dev libncurses5-dev libncursesw5-dev
sudo apt-get remove tmux
sudo make install
Then install [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm),
[Tmux Resurrect](https://github.com/tmux-plugins/tmux-resurrect) and
[tmux-continuum](https://github.com/tmux-plugins/tmux-continuum):
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm ```
Adding the following lines in the end of ~/.tmux.conf (without running tmux server):
# 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'
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
and run tmux source-file .tmux.conf
.
Start tmux and press prefix + I
to install all the plugins.
When finished, press prefix + Ctrl-S
(key shortcut for saving tmux session)
to verifiy the installation.
Now the tmux status will be saved to disk every 15 minutes,
or save it manually with prefix, Ctrl-S
.
After restarting computer, run tmux
in console,
all tmux sessions, windows and panes will be restored automatically
(or you can restore them manually with prefix, Ctrl-R
).
You can remove the temporary session with tmux kill-session -t 0
,
where "0" is the name of the temporary session.
Note:
For more details about tmux plugin manager (update, remove plugin, for example), see README.md of Tmux Plugin Manager.
If not install with apt-get
, you can install libevent
with downloading libevent-2.0.22-stable.tar.gz and install it from source.