Why is the terminal prompt unchanged when I log in as root? I.e, my default prompt is 0|storm@sky:~ %, but when I log in as root, it's something like ~ root] #. How do I change that variable, and would it affect my other prompts?
Asked
Active
Viewed 477 times
1
Eugene
- 87
1 Answers
3
@Eugene.
I'm not sure if I understand your question but if by "prompt" you mean the $PS1 variable you can try to change it through one of these files ~/.bash_profile or ~/.bashrc or /etc/profile. Those files would be read by the shell after you login, which means you'll have to logout and login again to make those changes available.
The $PS1 variable is the first prompt string variable which defines your 0|storm@sky:~%. The second one is the $PS2 which is usually seen as ">" ("greater than" symbol).
Let me show you some options:
$ PS1="\d$" #date format
Sun Jan 9$
$ PS1="\u$" #username
john$
$ PS1="\h$" #hostname
your_computers_name$
The combination of some of these options will define your prompt string.
Hope it helps.
ekkos
- 46
- 5