Use a Different Color for the Root Shell Prompt

Linux only: This is an excellent tip that changes the prompt to red when using the root account from the terminal—as a reminder to be more careful. Using the tip is relatively simple—just edit the /root/.bashrc file and add in the following, preferably commenting out the existing lines that set the color, though you can simply add this line to the end of the file.

Centos:
PS1='\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Debian:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 
You will need to play with the colours, but something like this should do the trick. Create/edit the file /etc/profile.d/colours.sh (or /etc/bashrc) with content similar to this:

#Color root promt
if [ $(id -u) -eq 0 >/dev/null  2>&1 ]; then
#red
export PS1="\[\033[01;31m\]\u@\h\[\033[00;37m\]:\w\$ "
else
#green
export PS1="\[\033[01;32m\]\u]@\h\[\033[00;37m\]:\w\$ "
fi

It should load up when you login… to effect it immediately after editing, do a:
source ~/.bashrc