How to change from bash-3.2$ to [user@localhost ~]$ in UNIX
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.
12 Answers
take a look at 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
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