# colors in bash (ls and git log, strange behaviour)



## deadeyes (Dec 4, 2010)

I want to post this for someone else who might have the same issue
I use the bash shell.

The issue
---------
ls does not use colors.
git log does not show colors.

What I tried first (determines if you have the same issue as me)
------------------
I searched the internet and found a command:
`ls -G`
This showed colorized ls output. This means the terminal type is correct (xterm/xterm-color didn't make a difference)

So I went for a search to enable colors in "git log".

```
git config --global color.ui true
```

Now when I did: `git log`
I got no colors !BUT! I got the color codes in the output. (Like [0,32m,...)
So somewhere it was not processing the color codes correctly.

What brought me to the solution
-------------------------------
I have read that you need CLICOLOR set in .bashrc.
However that did not work. THis only worked when I opened another bash shell in the existing one.

The solution
------------
Add

```
export CLICOLOR=yes
```
to
~username/.bash_profile

after doing this it worked.


----------



## rpi-user (Jan 8, 2015)

I had some issues with colors of `git log` as well where it'd print escape codes instead of color.

I put 
	
	



```
export CLICOLOR=yes
```
 in my .bash_profile, logged out and in and it worked.

I didn't like the other colors of directories and such so I commented out the 
	
	



```
export CLICOLOR=yes
```
 in my .bash_profile. I logged out and in and strangely, `git log` colors now work as they should while at the same time I don't have the colors of `ls`. So all is well for me though I did find it a bit confusing that it'd change like this.

I should note that I'm using my FreeBSD computer through SSH. I haven't looked at how `git log` looks at the console.


----------

