The typical use of a .d
directory is to hold multiple config files (typically sharing a common file extension, such as *.conf
) which are then merged or composed to produce a single logical configuration. This mechanism is typically equivalent to one where the multiple config files were concatenated to form a single config file.
Applications typically evolved to use .d
directories in order to play nicer with Linux software packages (deb/rpm) and package managers. A .d
directory is nicer towards the use of packages by distributions, since then packages can simply "drop" a standalone file into a directory (which is a natural operation, as packages manage/contain files), rather than having to edit a shared configuration file to add a stanza to plug in that particular package. (In earlier days of Linux distributions, you'll see packages doing exactly that, editing existing configuration files, through post-install and pre-uninstall scripts.)
The use of a configuration directory named /etc/software_name
is more common when the application uses multiple configuration files for different purposes (and perhaps even using different file formats, such as JSON, ini files, etc.) In that case, you might want to use a directory to group all the configuration files for that same application, but if you're not expecting other packages (or system administrators) to want to extend the configuration by "dropping" new files into a directory, then you won't use a .d
directory.
Some systems end up using both actually. For example, yum
(the Red Hat package manager) has its own configuration file, but it also has a .d
directory for its own repos (/etc/yum.repos.d
.) I believe apt
is also similar, so you could look at that one if you're on Debian. You can see that setup makes sense, since you might want to manage adding/removing repositories by "dropping" new files into a .d
directory (either from packages you push, or through a configuration management system) without having to modify the existing one (which might be getting updates from the O.S. distribution itself.)