Dircolors: rules for _ext (rather than .ext)

colorsls

In UNIX, many file extensions do not contain the dot in front, as in bashrc rather than bash.rc or ssh_config rather than ssh.config

I would like to add dircolor rules for _config as well. However, when I add the line:

_config 01;31

I get an error: dircolors: `/etc/dircolors':126: unrecognized keyword _config

Is it possible to add extensions _ext to dircolors?

Best Answer

You can do this with *_config 01;31.

From man 5 dir_colors:

*extension color-sequence
    Specifies the color used for any file that ends in extension.

.extension color-sequence
    Same as *.extension. Specifies the color used for any file that ends
    in .extension. Note that the period is included in the extension, which
    makes it impossible to specify an extension not starting with a period,
    such as ~ for emacs backup files. This form should be considered obsolete.