Search code examples
linuxunixfilesystemsgnu

the Role of "/etc" in Zen of Unix / GNU Linux


I have a question on Zen of Unix / GNU Linux, which looks like an aha-moment for me...

Apparently ANY standard Unix/Linux program has a config file, which the most are located at /etc directory.

Can we derive the concept as follow:

1- As an application developer you should design your software which have a customiztion file (possibly located at /etc.)

2- Then, Admins or users can SET these configs based on their needs and run your program.

3- Changing the behavior of your program should ONLY depends on its config file.


Solution

  • If you're asking whether this is true, that tends to be the convention, yes. Keep in mind that developers are free to design their programs to run however they want to and that they tend to follow this pattern only for convenience of similarity.

    Other patterns you may see:

    • Programs with no global settings and only per user settings may store their settings in ~/.[something], or maybe somewhere else entirely. Many programs do this AND use /etc. Bash is a good example, using /etc/profile/.bashrc for default settings and ~/.bashrc for user settings.

    • Very large standalone installations of some programs may package all of their files into their own .../etc, .../bin, etc.. directories, and will not use the typical system directories at all. An example of this is charybdis, an ircd, which stores everything in a folder specified at compile time (Mine lives in /var/ircd, so I have /var/ircd/etc, /var/ircd/bin, /var/ircd/lib, ...)