0

Looking for a way to automatically start a tmux session with my preferred panel splitting and start commands, I saw that in this post answer it was explained you could set everything up in your .tmux.conf file. Back then, they were talking about tmux v1.6 in 2013.

However, after trying and failing and googling again, I read here that tmux cannot restore sessions. This answer is from 2017.

I am currently using tmux 2.6, and I am beginning to think that the feature from v1.6 does not exist anymore. Does someone know if this is right? If so, why did they deprecate that functionality?

cduguet
  • 442
  • 3
  • 21

1 Answers1

1

Both answers are correct. This feature still works, but the tmux syntax has changed between version 1 and 2. You cannot restore sessions. You can create a new session with an identical name and panel layout as a session you've destroyed, but that will not bring back the old session and the contents of those destroyed panes.

Here is a trivial example:

#~/.session.tmux
new  -s SessionName -n WindowName
splitw -v -p 10

on the command line:

tmux source-file ~/.session.tmux

will bring up a tmux session with 1 window split into 2 panes, with the bottom pane being much smaller than the top pane.

jeremysprofile
  • 10,028
  • 4
  • 33
  • 53