0

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.

migrated from stackoverflow.com Mar 14 '12 at 11:11

This question came from our site for professional and enthusiast programmers.

0

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

0

I noticed I got this same issue when I ran

Akinjides-MacBook-Pro:Desktop akinjide$ $SHELL

The output was 
bash-3.2$ 

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 
bash-3.2# 

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.