/var/log

Colorize bash prompt on different servers

I often login on development and production servers. Sometimes I'm not sure anymore if I'm on development or production, which can cause some serious issues, like deleting a file on production...

An easy solution is to colorize the bash prompt different on development and production.

On my development server, I have a black background and white foreground with the following line in my .bashrc or .bash_profile:

export PS1="\[\e[0;37m\]\[\e[40m\]\u@\h \w \[\e[m\] "

On my production server, I have a red background and white foreground:

export PS1="\[\e[0;97m\]\[\e[101m\]\u@\h \w \[\e[m\] "
Tag: , | Category: