2

My username in the terminal usually green.

It is no longer green.

How can I fix this?

enter image description here

closed as off-topic by Milliways, techraf, joan, Steve Robillard, Darth Vader Nov 24 '17 at 19:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – Milliways, techraf, joan, Steve Robillard, Darth Vader
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Which OS ? Is this on a Pi ? – CoderMike Nov 22 '17 at 20:54
  • 3
    Are you logged in locally or remotely? Did you edit the .bashrc file? – Steve Robillard Nov 22 '17 at 21:07
  • Looks like maybe you had a custom prompt before, but it's somehow been reset to default. You might want to google "BASH Prompt Basics". There are lots of resources out there on how to customize it to your own desires. It won't be long before you have your green user ID back! – MrChips Nov 23 '17 at 4:49
4

Your ~/.bashrc file might have been modified. On a Rasberry Pi, the default Raspbian ~/.bashrc file has the following code in it for setting the prompt color:

# 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

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

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
unset color_prompt force_color_prompt

Check to see if you have something similar, and if not, then you can try putting this code in, or maybe even set up your own custom prompt. For a great tutorial on how to do this, check out: How to customize your BASH Prompt.

Not the answer you're looking for? Browse other questions tagged or ask your own question.