When tmux opens, I would like it to use zsh instead of bash by default. How would I accomplish this?
To change the default login shell we'll use chsh , a command line tool to change the login shell. This program changes the login shell by modifying the /etc/passwd file and setting the $SHELL environment variable.
From man tmux
:
default-shell path
Specify the default shell. This is used as the login shell for new windows when the default-command option is set to empty, and must be the full path of the executable. When started tmux tries to set a default value from the first suitable of the SHELL environment variable, the shell returned by getpwuid(3), or /bin/sh. This option should be configured when tmux is used as a login shell.
So, in your tmux.conf
:
# set shell set -g default-shell /bin/zsh
and if you want you can add default command each time, when we start a new window:
# Retach userspaces set -g default-command "reattach-to-user-namespace -l zsh"
You probably want zsh to be your default shell for most things, then (but this will not apply to cron). The following will make zsh your default shell, and you should then not need to tell tmux anything.
chsh -s /usr/bin/zsh
Note that some OSs still use /bin/zsh
as the path to zsh.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With