shadowbyte
Posts: 18
Joined: Sat Apr 09, 2016 3:29 am

Why is .bash_profile killing my terminal colors?

Sat Apr 09, 2016 9:12 pm

When I create a .bash_profile with one alias command, it's killing all of my terminal colors (all text is white on black at re-login).
If I delete the .bash_profile and log back in everything is fine again.

What's happening here?

Thanks in advance.

gcal
Posts: 1
Joined: Thu May 05, 2016 1:42 pm
Location: Rochester, NY, USA

Re: Why is .bash_profile killing my terminal colors?

Thu May 05, 2016 1:57 pm

When bash starts, it looks for .bash_profile, and if it exists then it is sourced. If .bash_profile does not exist, then .profile is sourced.

By default, .profile calls .bashrc, and .bashrc sets up some things for color (your prompt, and ls output). If your .bash_profile doesn't call .bashrc, and doesn't have the color configurations, then color never gets setup, and you get white on black.

The most straightforward way to get all of the configurations back, including colors, is to source .bashrc from .bash_profile. I do this by having the following lines near the end of my .bash_profile:

Code: Select all

# source the user's bashrc if it exists
if [ -f "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi
Good luck!
-Gerry

Return to “Troubleshooting”