6

My tmux started to behave in a strange way, briefly. Today I noticed that my tmux session does not start with a bash shell but instead it starts with ?(no idea). What I can see is just a dollar $. Then if I try to call bash with bash it returns

sessions should be nested with care, unset $TMUX to force.

tmux without bash

I wanted to add a default-shell for tmux in the ~/.tmux.conf file, but it doesn't exist and if I create it tmux seems not seeing it.

2
  • What is the output of echo $0 ? Commented May 9, 2017 at 12:59
  • The output is sh
    – Peter
    Commented May 9, 2017 at 15:05

1 Answer 1

5

Manual page of tmux state the default-shell option process:

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.

To set the default shell of tmux to Bash in .tmux.conf file, you must write it as: set-option -g default-shell "/bin/bash"

If you want to set your system default shell (not specifically bash) as default-shell, you can do set-option -g default-shell $SHELL in your .tmux.conf file. This requires that the $SHELL variable is correctly set, though. See https://superuser.com/a/395161/325399

1
  • I just encountered this as well - tmux always used my defauilt shell an I am wary of meddling with that now...
    – xeruf
    Commented Nov 20, 2024 at 14:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .