Linux root prompt color
From Birnam Designs Wiki
To set a special color for the prompt for root users (to make commands issued as root stand out more visually), first login as root with su - and edit ~/.bashrc. There are two methods which might work:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' PS1='\e[1;31m\u@\h\e[m [\w]# '
In both cases, PS1 is the variable to set the prompt code. The top example uses several colors -- 31, 34, and default. The second only uses 31. In the first case the color is set by first assigning a color, and then assigning the default:
\[\003[xx;yym\]....\[\033[00m\]
In the second case a colored area is delimited by open and close tags:
\e[x;yym....\e[m
xx;yy is the color. xx refers to 00 (darker variation) or 01 (lighter variation). yy can be:
| color numerical values | |
|---|---|
| 30 | Black |
| 31 | Red |
| 32 | Green |
| 33 | Brown |
| 34 | Blue |
| 35 | Purple |
| 36 | Cyan |