Enable shell colored prompt on Ubuntu / Debian

Look at your home directory and the file .bashrc. Find these lines:

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
Uncomment force_color_prompt=yes, save and login again.

 For root to have colored prompt, but with different color f.e. red, find the same file in .root directory and also uncomment force_color_prompt and look for:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

Look for number 32, marked with green color and change it to 31 (red), save and re-login.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.