What does the suffix .d mean in Linux?

Solution 1:

"d" stands for directory and such a directory is a collection of configuration files which are often fragments that are included in the main configuration file. The point is to compartmentalize configuration concerns to increase maintainability.

When you have a distinction such as /etc/httpd/conf vs /etc/httpd/conf.d, it is usually the case that /etc/httpd/conf contains various different kinds of configuration files, while a .d directory contains multiple instances of the same configuration file type (such as "modules to load", "sites to enable" etc), and the administrator can add and remove as needed.

Solution 2:

The main driving force behind the existence of this directory naming convention is for easier package management of configuration files. Whether its rpm, deb or whatever, it is much easier (and probably safer) to be able to drop a file into a directory so that it is auto included into a program's configuration instead of trying to edit a global config file.

A good example of this is logrotate. In the directory /etc/logrotate.d are config files for practically every application you have installed that keeps a log in /var/log. Some are bunched into the syslog config because nearly every system has a messages, wtmp and lastlog file. But if you install Apache on your system, you need an easy way of automatically adding the config for rotating Apache's logs, so it just drops a config file called httpd in /etc/logrotate.d and logrotate is configured to include the files in that directory. Each one is owned by the package for the daemon and if you remove the package it will remove the file. Its basically a way of modularizing config files. Note that this needs to be supported by the program, its not something automatic that the system does for you or something. Usually programs that do it have a config directive called include that specify where that directory is located on the filesystem.

logrotate.d might even be the first place this convention was used outside of the init.d and rc.d directories for init scripts.