Skip to content

How to check current shell in Linux

homepage-banner

Introduction

In Linux, a shell is a program that interprets and executes commands. It is the interface between the user and the operating system. There are various types of shells available in Linux, such as Bash, Zsh, Ksh, and many more. Each shell has its own set of features and functionalities. In this blog post, we will discuss how to check the current shell type in Linux.

From SHELL

echo $SHELL

From env

env |grep SHELL

$0

echo $0

ps

ps |grep $$ 

Conclusion

In conclusion, checking the current shell type in Linux is a simple task that can be done using the echo $SHELL command. Additionally, you can check the available shell types on your system using the cat /etc/shells command. Knowing the current shell type is essential for executing commands and scripts that are compatible with your shell.

Leave a message