How to Configure User Login Shell in Linux
Hey there! Welcome to this Linux tutorial from ProgramGuru.org.
Today, we’re going to learn how to configure the login shell for a user. This is useful when you want to switch from the default shell—like bash—to something else like zsh or fish.
Let’s walk through it step-by-step, nice and easy.
🔍 What is a login shell?
A login shell is the command-line interface that starts when you log into your Linux account. It can be Bash, Zsh, Fish, or any shell listed in /etc/shells.
🛠️ Step 1: Check your current shell
To check what shell you're using right now, run:
echo $SHELL
You’ll get an output like:
/bin/bash
📄 Step 2: View available shells on your system
Let’s see what shells are available on your system. These are usually listed in /etc/shells.
cat /etc/shells
Sample output might look like:
/bin/sh
/bin/bash
/usr/bin/zsh
/usr/bin/fish
⚙️ Step 3: Change your shell using chsh
The easiest way to change your shell is with the chsh command. Run:
chsh -s /usr/bin/zsh
Note: You need to enter the full path to the shell, and it must be one of the options listed in /etc/shells.
After you run the command, you may be prompted to enter your password.
🔁 Step 4: Log out and back in
To activate the new shell, log out of your session and log back in. Then run:
echo $SHELL
You should now see your new shell:
/usr/bin/zsh
🧪 Optional: Test the shell
You can also test the shell before switching permanently by running it directly:
/usr/bin/zsh
Once inside, type exit to return to your original shell.
🔒 Admin Tip: Change shell for another user (root only)
If you're a system administrator and want to change the shell for another user, use:
chsh -s /bin/bash username
📦 Bonus: Install a new shell
If the shell you want isn’t installed, you can add it using:
sudo apt install zsh # On Debian/Ubuntu
sudo dnf install zsh # On Fedora/RHEL
brew install zsh # On macOS with Homebrew
✅ Recap
- Check your current shell with
echo $SHELL - List available shells from
/etc/shells - Change the shell using
chsh -s - Log out and back in to apply changes
And that’s it! You’ve successfully learned how to configure your login shell in Linux. Happy customizing!
🎥 This tutorial is part of the Linux Basics series by ProgramGuru.org.
