• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

Which Shell Am I Using? How To Find Out

Benjamin O'Donald

Published on: January 23, 2025

Categories: Linux Command Line 0

Table of Contents
  • How to find your current running shell?
    • Method #1
    • Method #2
    • Method #3
  • How to change your shell in Linux
    • 1. Check for a list of available shells
    • 2. Change to another shell
  • Change the login shell for a user persistently
    • Method #1: Edit the shell in /etc/passwd for your user
    • Method #2: Using the usermod command
    • Method #3: Using chsh
  • Conclusion

Linux offers different variations of shell types which can be utilized in terminal. Common shells such as BASH (Bourne Again Shell), ksh (Korn Shell), csh (C Shell), sh (bourne shell), tsch (TC shell) among others are available on linux operating systems.

Ever wonder which shell you are using when accessing a Linux server in terminal? In this article we’ll go over how to find out your current shell.

How to find your current running shell?

To find out which shell you are using while logged into a Linux operating system you can use either of the 3 methods below:

Method #1

First you could run the following echo shell command in the terminal window as your user which will show the current shell in use (which is BASH per the below output):

$ echo "$SHELL"

Alternatively you can run the following echo command to determine the name of the shell in use:

$ echo $0

Method #2

You could also use the following on the command line to determine the currently running shell name:

$ printf "My current shell - %s/n" "$SHELL"

Method #3

The ps command can also be utilized to determine the shell in use per the following command:

$ ps -p $$

As we can see from the above the output indicates we’re using the BASH shell for our user.

How to change your shell in Linux

Usually the BASH shell is default on most Linux distributions and on my Ubuntu server both root and all newly created users are set to run in BASH. But what if we’d like to change the shell for a user?

1. Check for a list of available shells

First lets check to see all the available shells we could choose from by reviewing the /etc/shells file:

$ cat /etc/shells 

2. Change to another shell

For this example lets say we want to change from BASH to zsh for our shell.

To change from the current shell you are using to the zsh shell you can enter in the following command:

$ zsh

Now you may receive the following options and if so just choose option 2 to populate your ~/.zshrc file with the recommended configuration:

As we see from above we selected option 2 and it created the recommended configuration file then put our user into the zsh shell.

Please note that changing shells in this manner will not be persistent and when you create a new session you will be logged back into whichever shell is default.

In this case my user has BASH setup as their shell so upon creating a new session they would enter back into BASH.

Change the login shell for a user persistently

If you want to change the default login shell for a user and make it persistent there are a couple of different methods.

Each method below involves edits to the /etc/passwd file which contains all of your users and the shell set for them.

Method #1: Edit the shell in /etc/passwd for your user

From the list of available shells in /etc/shells you can update your passwd file for the desired user which will update their default login shell.

In this example I changed the bodonald user’s shell from /bin/bash to /bin/zsh:

Now when we change to that specific user we see the zsh shell is in use upon login from the output:

Method #2: Using the usermod command

As the root user or sudo privileges user you can also utilize the usermod command along with the –shell flag to change the shell for a user persistently.

This command will automatically edit your /etc/passwd file for the desired user to update their default shell.

This can be done with the following command to update a user so that zsh is used as their shell persistently:

$ usermod --shell /bin/zsh bodonald

Method #3: Using chsh

Another method is to use the chsh command with the -s flag on a user to update their default shell.

Like the previous method, this command will automatically edit your /etc/passwd file for the desired user to update the shell used on login.

This can be done as root or a sudo user such as in the following where we change the bodonald user back to BASH as their default shell:

$ chsh -s /bin/bash bodonald

Conclusion

Linux offers many different shells which can be utilized and it is quite easy to change the default shell for a specific user if needed.

In this article we went over how you can not only tell which shell is being used but also how to switch to a different shell within your current session or update the default shell type for a specific user.

Related Posts

How to Use the Tee Command in Linux

The tee command in Linux is useful when you want to direct the output of a command to multiple locations. Here's how to use it.

All About Bash Parameter Expansion

Parameter expansion in bash is very useful when working with strings like filenames and log entries. It allows you to clean up text.

Resolving the “Fatal: Refusing to Merge Unrelated Histories” Error

The "fatal: refusing to merge unrelated histories" occurs when you try and merge an unrelated repo into your own. Here's what it means.

Nmap Scan Types: How to Scan a Server’s Network

The "nmap" command allows you to scan a remote server and determine its network configuration. Here are the various nmap scan types.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA