0

Is there a config file that stores the default shell (bash, zsh, etc) for the current user ?

  • Terminals don't have shells, users do. – Ignacio Vazquez-Abrams Jul 30 '18 at 17:41
  • @IgnacioVazquez-Abrams Thanks, edited – faressoft Jul 30 '18 at 17:43
5

The default shell used by a user is contained in the seventh field of /etc/passwd or its equivalent.

$ getent passwd xxxxxx | awk -F: '{ print $7 }'
/bin/bash
  • Is there another way that doesn't require access to such file like passwd – faressoft Jul 30 '18 at 17:44
  • The only reliable place this information can be found is passwd. – Ignacio Vazquez-Abrams Jul 30 '18 at 17:45
  • When I install zsh how doesn't mark itself as the login shell – faressoft Jul 30 '18 at 17:46
  • 1
    Did you use chsh to tell the system to use it? – Ignacio Vazquez-Abrams Jul 30 '18 at 17:47
  • 1
    @faressoft: You can check that with strace, for example strace chsh -s $(command -v bash) |& grep open – Arkadiusz Drabczyk Jul 30 '18 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.