Skip to content

Instantly share code, notes, and snippets.

@SebastianGrans
Last active December 25, 2023 14:41
Show Gist options
  • Save SebastianGrans/0f25575bcdf7a758c2dbeccf20af65e1 to your computer and use it in GitHub Desktop.
Save SebastianGrans/0f25575bcdf7a758c2dbeccf20af65e1 to your computer and use it in GitHub Desktop.
Better `ls` colors

Directories with 777 permissions look pretty ugly when you list files (see first example in picture below). This happens if you do ls in /mnt/c/ in WSL.

image

Simply changing the background to light gray makes a big difference. While I was fiddling around I discovered that I quite like having directories to be orange.

You can change this by simply adding the following line to your .bashrc/.zshrc/etc. Make sure to put it before the line source $ZSH/oh-my-zsh.sh, otherwise the autocompletion will use the default colors. source

LS_COLORS="$LS_COLORS:di=1;33:ow=33;100"
export LS_COLORS

# Add it before `source $ZSH/oh-my-zsh.sh`!

Edit: If you use zsh the colors in the autocomplete might still be shitty. This is because they are controlled elsewhere. If you run zstyle, you'll find a list of colors. Maybe I'll update this post on how to change those later.
Edit2: As long as you place it before it sources oh-my-zsh.sh, it'll work out of the box. source

You can read more about the LS_COLORS variable here: https://askubuntu.com/questions/466198/how-do-i-change-the-color-for-directories-with-ls-in-the-console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment