Open In App

List out all the Shells Using Linux Commands

Last Updated : 22 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

There are various methods to list all the shells which are installed in our Linux system. A Shell is a software program that acts as an interface between the user and the operating system(OS). It can also be thought of as a command interpreter that is used to execute another program.

Method 1: Using cat command

Example:

cat /etc/shells
using cat command to find the shells in Linux

Using ‘cat’ command

Explanation: The list of all the shells which are currently installed in our Linux system is stored in the ‘shells’ file which is present in /etc folder of the system. It has read-only access by default and is modified automatically whenever we install a new shell in our system. As we can see, the cat command displays the various installed shells along with their installation paths.

Method 2: Use of grep command with Regular Expressions.

Example:

grep '^[^#]' /etc/shells
using grep command to find shells in Linux

Using ‘grep’ command

Explanation: Regular Expressions are one of the most powerful tools that come in handy when handling complex expressions. We can use regular expressions with grep command to display all the shells installed in our system as shown above.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads