In bash, I have colored output set up for commands such as ls. I customized the exact colors used with the LS_COLORS environment variable, since the default ones were kind of ugly.

From what I understand the LS_COLORS variable is also supposed to be used to set the color specs for colored tab completion, but that doesn't seem to work. The colored tab completion continues to use the default color specs.


I already have colored completion by putting bind 'set colored-stats on' in my ~/.bashrc file. I'm asking why the colored completion doesn't obey the customizations set in LS_COLORS. Please don't mark me as a duplicate of https://superuser.com/questions/251107/how-to-get-a-colored-tab-completion is there a way to set coloring for cd tab complete? or something similar.

See the attached screenshot. The top command is when I run ls. The second is when I type ls and hit tab. I also tried setting LSCOLORS environment variable, but no luck. I'm using bash 4.4.19 and my $TERM is "xterm-256color" if thats relevant.

different color for ls and tab completion


The exact way I'm setting the LS_COLORS variable is by having eval "$(dircolors ~/.dircolors)" in my ~/.bashrc file. The ~/.dircolors is what I customized. This sets my LS_COLOR to the following (which successfully customizes my ls output but not tab completion).

$ echo $LS_COLORS
  • I have eval "$(dircolors ~/.dircolors)" in my bashrc that sets LS_COLOR. The exact value is quite long since I have a lot of customizations (I'll edit my question and add it there). The customizations are working for ls but not for tab completion. I honestly have no idea what could be wrong or how to troubleshoot this. – Cnoor0171 Oct 19 at 19:54
  • Doesn't work for me either. – ilkkachu Oct 19 at 20:31
  • did you export LS_COLORS at all? – rastafile Oct 19 at 20:39
  • @Cnoor0171 well no the way you call it. OK so now that is the problem. Somehow between eval and dircolors the export gets lost. – rastafile Oct 19 at 20:44
  • 1
    @rastafile the dircolors command puts the export automatically. The export is definitely working, because without it the output of ls wouldn't be colored either. – Cnoor0171 Oct 19 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.