Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change tmux default to zsh

Tags:

zsh

tmux

When tmux opens, I would like it to use zsh instead of bash by default. How would I accomplish this?

like image 551
user3549902 Avatar asked Apr 27 '14 01:04

user3549902


People also ask

How do I change the default shell in Fedora?

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.


2 Answers

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" 
like image 123
jasonwryan Avatar answered Oct 26 '22 01:10

jasonwryan


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.

like image 43
Micah Elliott Avatar answered Oct 26 '22 03:10

Micah Elliott