Hi there
I changed the default SUSE prompt setting by modifying the shell variable PS1 to display the following information:
• \u : the username of the current user
• \h : the hostname up to the first ‘.’
• \w : the current working directory, with $HOME abbreviated with a tilde
I used export command to setup a new shell prompt:
• export PS1="\u@\h: \w]$ "
To add colors to the shell prompt and make a regular user prompt blue I used the following command syntax:
• export PS1="\e[0;34m[\u@\h: \w]$ \e[m "
Where,
• \e[ Start color scheme
• x;y Color pair to use (x;y)
• $PS1 is your shell prompt
• \e[m Stop color scheme
List of Color code
Color Code
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
• Replace digit 0 with 1 to get light color version.
Finally to make the prompt setting permanent I added above export command to my .bashrc file.
I’d like to do the same for root. In Slackware or Debian in order to modify PS1 you need to edit root’s .bashrc config file that is located here, ‘/root/.bashrc‘. Unfortunately there isn’t such file in SUSE. So when I su – to became the super user I get the default prompt.
for root you must read and modify /etc/bash.bashrc
VampirD
Microsoft Windows is like air conditioning
Stops working when you open a window.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/
I may be wrong, but I doubt this.* /etc/bash.bashrc* would be a central default for everybody, thus not only root, but all other users also. Thus when you want this prompt to be the default for all your users (root, yourself, your spouse, your children, whoever has a user id on the system) this is the correct place (but beware, updates could destroy this and thus, like the file itself says, do this in /etc/bash.bashrc.local).
Every user can do this individualy in his/her ~/.bashrc as you found (and thus overriding any default you may have put in /etc/bash.bashrc). That is also true for root. When there isn’t none, create it. Putting in it only the statements you need is enough.
As an addition. The fact that there is no ~/.bashrc for root is most probably because one should not use many statements when root logs in. This to avoid root not being able to log in when the system is in big problems and many things normaly available will simply not be there. Thus allways handle anything done with root with care.
Remind the rule: when it is not needed to do things as root, don’t do it using root. Changing it’s prompt is one thing that is definitely not needed. And allthough it might look very innocent what you are doing, be carefull.