When working with multiple environments (linux) it is handy to have them color coded so you can always tell when you are in Prod versus a non-prod environment (depending on how you are set up)
For me it has always just been something I do as a personal preference so I don't accidently make a change to the wrong environment when I am in a rush and have a dozen terminal tabs open ;-)
We will be creating a file in the systems profile directory (you could just make this local to your profile)
nano /etc/profile.d/set_ps.sh
Then add the following to that file.
#!/bin/bash
H=$(hostname | sed -E 's/\.?(lab|pre)*.visionjinx.net//');
if [ $UID -eq 0 ]; then
export PS1="\[$(tput setaf 1)\]\u@$H \[$(tput rev bold)\][PROD]\[$(tput sgr0)\]\[$(tput setaf 1)\]\w # \[$(tput sgr0)\]"
else
export PS1="\[$(tput setaf 1)\]\u@$H \[$(tput rev bold)\][PROD]\[$(tput sgr0)\]\[$(tput setaf 1)\]\w $ \[$(tput sgr0)\]"
fi
This will make my login a little more distinct as well as color it "Red" for production. I added my domain for reference, but change it to your systems hostname.
nixCraft - Change the color of your bash/shell prompt You can visit this site for a more in-depth break down of what I was doing here. I realize I didn't go into much explanation as to what I was doing, just here is the code, more for personal reference.