Skip to main content
Clarity. The files in `.d` directory are sorted lexicographically not alphanumerically. Using so, so much, sounds juvinile. Use markdown. Configuration files are read not ran.
Source Link

To clarify answers a bit.

InCommonly, Linux directories suffixed with .d Like.d, such as /etc/sysctl.d/etc/sysctl.d or /etc/yum.repos.d etc/etc/yum.repos.d, contain configconfiguration files, themselves often suffixed with .conf. Any fileThe files in this folderthese kinds of directories will be ran in alphanumeric order. So if you copy a file in a .d folder and rename it it will still runsorted and will runread in the alphanumericlexicographic order of the file name. So

In order to get files in a .d folder.d directory to execute in a specificdesired order say, to load some settingconfiguration prior to another, then as a convention we addprefix the filename with a number in front of the file name to more easily control the order of executionthe files are read. So

For example, if you had the files like this:

    10-firstFilename.conf
    20-anotherFile.conf
    30-lastfileToRun .conf

theyThey will runbe sorted and read in this order.

Files WithoutThe same files without the numbersnumerical prefix would runbe sorted in thisthe order:

    anotherFile.conf
    firstFilename.conf
    lastfiletoRun.conf

You can see how the numerical prefix helps implement the desired order.

To clarify answers a bit.

In Linux directories with .d Like /etc/sysctl.d or /etc/yum.repos.d etc contain config files. Any file in this folder will be ran in alphanumeric order. So if you copy a file in a .d folder and rename it it will still run and will run in the alphanumeric order of the file name. So to get files in a .d folder to execute in a specific order say to load some setting prior to another then we add a number in front of the file name to control the order of execution. So if you had files like this

10-firstFilename
20-anotherFile
30-lastfileToRun 

they will run in this order.

Files Without the numbers would run in this order

anotherFile
firstFilename
lastfiletoRun

Commonly, Linux directories suffixed with .d, such as /etc/sysctl.d or /etc/yum.repos.d, contain configuration files, themselves often suffixed with .conf. The files in these kinds of directories will be sorted and read in lexicographic order.

In order to get files in a .d directory to execute in a desired order, to load some configuration prior to another, then as a convention we prefix the filename with a number to more easily control the order the files are read.

For example, if you had the files:

    10-firstFilename.conf
    20-anotherFile.conf
    30-lastfileToRun.conf

They will be sorted and read in this order.

The same files without the numerical prefix would be sorted in the order:

    anotherFile.conf
    firstFilename.conf
    lastfiletoRun.conf

You can see how the numerical prefix helps implement the desired order.

Source Link

To clarify answers a bit.

In Linux directories with .d Like /etc/sysctl.d or /etc/yum.repos.d etc contain config files. Any file in this folder will be ran in alphanumeric order. So if you copy a file in a .d folder and rename it it will still run and will run in the alphanumeric order of the file name. So to get files in a .d folder to execute in a specific order say to load some setting prior to another then we add a number in front of the file name to control the order of execution. So if you had files like this

10-firstFilename
20-anotherFile
30-lastfileToRun 

they will run in this order.

Files Without the numbers would run in this order

anotherFile
firstFilename
lastfiletoRun