Bash on Ubuntu on Windows: Can't change (some) directory colors

11,705

Solution 1

When ls -l displays windows files outside the wsl the other writable causes the green background. As Schmendrick van der Distel said, create a dircolors in your home directory. Then change STICKY_OTHER_WRITABLE and OTHER_WRITABLE as below to remove the background.

dircolors -p > ~/.dircolors

Change in .dircolors to these values:

STICKY_OTHER_WRITABLE 31;00 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 31;00 # dir that is other-writable (o+w) and not sticky

Restart bash

Solution 2

I've had the same problem and solved it in the following way:

In my ~/.bashrc file I found the lines:

test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'

As I found no file named .dircolors in my home-directory, I exported the standardconfiguration via dircolors -p > ~/.dircolors

Now I've changed the line DIR 01;36 # directory to DIR 01;34 # directory (changed the color from blue to cyan), saved the file and restarted the BashonWindows.

Hope it will help

Share:
11,705

Related videos on Youtube

Sergei Wallace
Author by

Sergei Wallace

Software developer at Accenture Technology with data science (Python) and big data engineering/analytics (Scala, Apache Spark) experience.

Updated on September 18, 2022

Comments

  • Sergei Wallace
    Sergei Wallace over 1 year

    On the new Bash on Ubuntu on Windows (10) app, I have tried to change the directory colors from blue to some thing more visible but haven't been able to change some file/directory colors for some reason. How do I change all of the directory/file colors? My .bashrc file is currently set to have color prompt on the file and directory colors to be green and other bright colors. The settings are:

    LS_COLORS=$LS_COLORS:'di=1;31:fi=0;31;bd=0;32:fi=0;33:cd=0;96';
    export LS_COLORS
    
    if [ "$color_prompt" = yes ]; then
        PS1='${debian_chroot:+($debian_chroot)}\[\033[0;31m\]\u@\h\[\033[0,31m\]:\[\033[0;31m\]\w\[\033[0,31m\]\$ '
    

    Some files and folders have changed colors corresponding to my .bashrc file but others don't for some reason.

    Some example screenshots: enter image description here

    enter image description here

    enter image description here