Setting ls to reasonable colors in cygwin

I often navigate folders in Windows explorer without using the mouse. This is quick, as you can jump to any file or folder by typing the first letters of the name and use backspace to go up one level. The speed is probably faster than what you achieve in a bash shell, where you complete names with tab.

In the Windows explorer, folders are listed first and have a yellow icon, files are just plain black-on-white. Using the bash shell in cygwin, I wanted to retain these mnemonic features.

Here is what goes into my .bashrc to achieve this:

alias ls='ls -A --color=auto --group-directories-first'
alias ll='ls -lh'
export LS_COLORS

A few words of explanation. It defines two aliases, one shadowing the ls command itself to 1) hide the . and .. folders in each output using the -A option 2) use coloring on device which support it only with the --color=auto 3) have folders listed first with the --group-directories-first. The second alias is really just a shortcut (using the first!) long listed dirs (with human readable file sizes).

The colors are basically bright-yellow (33;01) for all dirs, red (31) for executable files and default (00) for all other files and text. Note that it doesn’t really make sense to define a color for executable files in cygwin, as all existing files are executable per default.