The number prefix in config files from .d directory

configurationconventions

A lot of unix config files in xx.d folders are prefixed by a number, like :

$ ls /etc/grub.d/
00_header        10_linux      30_os-prober      40_custom  
05_debian_theme  20_linux_xen  30_uefi-firmware  41_custom

Is there any convention on this number? What does it mean ?

Might just be to avoid name clashing but I'm curious if there's anything more.

Best Answer

It's a convention used both to keep filenames unique, and to control the order in which scripts get executed. In general, the xx.d directories are scanned by something doing the moral equivalent of for file in /etc/grub.d/*; do ... and the numeric prefixes give this an ordering other than alphabetical. There may be application-specific standards for what's a 4x_foo vs a 9x_foo but nothing consistent across all the xx.d directories.

Related Question