Ubuntu Terminal: How to set a User’s Shell to Bash Tips, Tricks and Tutorials 19 AUG 2013

ubuntu-10-logoGiven an installation of Ubuntu Server (or pretty much any other Linux variant that requires you to use a terminal), changing a user’s shell is thankfully pretty easy.

I generally like to use bash as my shell of choice, as it gives me the most user friendly and verbose interface to work in, meaning that I often find myself having to switch a newly installed system’s default out for bash for my freshly added user account.

And given that this post is more a reference for me than anything else, these are a useful set of steps to follow in order to change to Bash:

1. Check the user’s current shell by reading the entry in the /etc/passwd user information file.

grep craig /etc/passwd

Grep will return something that looks like craig:x:1006:1006::/home/craig:/bin/sh. That particular line tells us that the system is currently using sh as my shell.

2. Grab a list of available shells by reading the common /etc/shells file.

cat /etc/shells

3. Change the shell using the chsh command. If you are logged into your account, then chsh will first prompt you for your password, followed by a prompt for the new shell. Note, you have to enter the full path, as listed in /etc/shells.

Oh, you can also quicken the process by calling chsh with parameters, as indicated by the man page:

chsh -s /bin/bash craig


Related Posts:

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.