My current workflow is:
- CTRL+SHIFT+T to launch a new terminal window. That starts a new zsh terminal.
tmuxto start tmux.
How can I have tmux load by default with a new terminal window?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
There are at least two ways:
Write something like
if [ "$TMUX" = "" ]; then tmux; fi
at the beginning of
~/.zshrc. Note the conditional test to a possible loop when
tmux spawns its own
Modify terminal launching command to something like
xterm -e tmux
I prefer the second way, because sometimes I need to launch a terminal without
tmux (for example when I need to reconnect to an existing session).
There is actually a default plugin
Add it to your plugins list then set
ZSH_TMUX_AUTOSTART=true in your
For more reference, go here
My compromise is to automatically start
tmux if no sessions are running.
This way, only the first terminal window starts tmux. A following windows do not start
tmux and you can decide to attach to a session or to not use tmux at all there.
To do so add the following at the beginning of
if [[ ! $(tmux list-sessions) ]]; then tmux fi