I am newbie to UNIX. When I was practicing some commands in UNIX. Earlier the Prompt was shown like this "[user@localhost ~]$". After some time it shows "bash-3.2$", but still some commands worked. I tried to change the shell type from bash to ksh and csh. But that didn't worked. How can I change this bash-3.2$ back to [user@localhost ~]$ in bash shell.


take a look at http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html on how to set up the PS1 variable in bash. It has a wide variety of option


I noticed I got this same issue when I ran

Akinjides-MacBook-Pro:Desktop akinjide$ $SHELL

The output was 

so the $SHELL keyword runs the shell specified by the SHELL environment variable.

you can just type exit to leave.

if you run

Akinjides-MacBook-Pro:Desktop akinjide$ sudo -s

The output was 

According to man sudo

-s [command]: The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in the password database. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed.

This prompts for your password, and you can just type exit to leave as well.

The main different here is the $ -> Regular user and # -> Super User

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.