Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which shell I am using in mac

Default shell in my mac was bash.
I have tried to change it into ZSH by command chsh -s /bin/zsh.

Now when I am trying to check the shell type, I am getting different responses.

COMMAND-1

input : echo $SHELL
output : /bin/zsh

COMMAND-2

input : ps $o
output : 7655 ttys002 0:00.03 -bash

COMMAND-3

input : ps -p $$ | awk '$1 == PP {print $4}' PP=$$
output : -bash

I am not sure which shell I am using. Do I need to do something additional to change my shell into ZSH.

like image 651
shantanu Avatar asked Apr 14 '17 18:04

shantanu


People also ask

How do I know which shell I am using on Mac?

In the Terminal app on your Mac, choose Terminal > Preferences, then click General. Under “Shells open with,” select “Command (complete path),” then enter the path to the shell you want to use.

How do I know which shell I am using?

How to check which shell am I using: Use the following Linux or Unix commands: ps -p $$ – Display your current shell name reliably. echo "$SHELL" – Print the shell for the current user but not necessarily the shell that is running at the movement.

Is my Mac using Bash or zsh?

Update your Terminal preferences to open the shell with the command /bin/bash , as shown in the screenshot above. Quit and restart Terminal. You should see “hello from bash”, but if you run echo $SHELL , you will see /bin/zsh .

How do I know if I am using Bash or zsh?

Now, coming to the article's main subject, how will you know that you have bash or zsh? The answer is quite simple. Use the “–version” command to confirm the existence of both shells on your Linux system.


1 Answers

Assuming you're using the standard Terminal.app and you've verified that it is indeed configured to use your default login shell, as described in NobodyNada's helpful answer:

To see what shell is currently running (which may or may not be your default shell), use:

ps -o comm= $$ 

To see what shell is your default shell, run:

echo $SHELL 
like image 93
mklement0 Avatar answered Sep 16 '22 21:09

mklement0