---

Understanding the $SHELL Environment Variable in Unix and Linux

In Unix and Linux systems, the $SHELL environment variable indicates the parent shell that initiated your current session. This can be useful for understanding the runtime environment, particularly when troubleshooting or scripting. It’s important to know that this value doesn’t always reflect your default login shell—it shows the shell that started your current session.

For example, if you start a new shell within your login shell, $SHELL still shows the original one. For more system-related insights, see our guide on how to install Kernel 6.15 on Ubuntu, learn useful grep tricks for ps, or explore the Linux yes command for automating responses.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis