Search code examples
linuxunixls

DIR_COLORS customization


I am customizing my DIR_COLORS (~/.dir_colors) to colorize ls on my terminal.

I get how to change colors of files whose names ends in a known extension:

.cpp 0;34

But I would like to set colors for files with a fixed name like Makefile and Kconfig, and I would also like to change colors of files that begins with a dot (like .config), or some other pattern.

Is this possible?


Solution

  • There's no way to do it using dircolors, unfortunately. One way to cope with single files like Makefile or Kconfig is to use:

    *Makefile 00;36
    

    Unfortunately, this colors everything which ends with Makefile, not just Makefile. Coloring files which start with a particular prefix is probably impossible.