Setting bash As Your Default Shell
Problem
You’re using a BSD system, Solaris, or some other Unix variant for which bash isn’t the default shell. You’re tired of starting bash explicitly all the time, and want to make bash your default shell.
Solution
First, make sure bash is installed. Try
typing bash --version at a
command line. If you get a version, it’s installed:
$ bash --version GNU bash, version 3.00.16(1)-release (i386-pc-solaris2.10) Copyright (C) 2004 Free Software Foundation, Inc.
If you don’t see a version number, you may be missing a directory
from your path. chsh -l or cat /etc/shells may give you a list of valid shells on some systems.
Otherwise, ask your system administrator where bash
is, or if it can be installed.
chsh -l provides a list of valid shells on Linux, but opens an editor and
allows you to change settings on BSD. -l is not a valid option to chsh on Mac OS X,
but just running chsh will open an editor to allow you to change settings, and
chpass -s
shell will change your shell.
If bash is installed, use the chsh -s command to
change your default shell. For example, chsh -s
/bin/bash. If for any reason that fails try chsh, passwd -e, passwd -l
chpass,or usermod -s
/usr/bin/bash. If you still can’t change your shell ask your system
administrator, who may need to edit the /etc/passwd
file. On most systems, /etc/passwd will have lines
of the form:
cam:pK1Z9BCJbzCrBNrkjRUdUiTtFOh/:501:100:Cameron Newham:/home/cam:/bin/bash cc:kfDKDjfkeDJKJySFgJFWErrElpe/:502:100:Cheshire ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access