Skip to content

Instantly share code, notes, and snippets.

@JacksonBailey
Last active March 19, 2020 19:56
Show Gist options
  • Save JacksonBailey/26e0b020c2efc2c81c9b1a7836016eef to your computer and use it in GitHub Desktop.
Save JacksonBailey/26e0b020c2efc2c81c9b1a7836016eef to your computer and use it in GitHub Desktop.
A very simple bash prompt that is red for root and green for other users. If you are using CentOS place in /etc/profile.d to have it apply globally
# are we an interactive shell?
if [ "$PS1" ]; then
if [ $(id -u) = 0 ]; then
PROMPT_COLOR="$(tput setaf 1)"
else
PROMPT_COLOR="$(tput setaf 2)"
fi
PS1="\[${PROMPT_COLOR}\][\u@\h \w]\\$ \[$(tput sgr0)\]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment