Have you ever edited any configuration file? If you are not using Windows or those fancy GUIs like YaST, you have probably encountered small issues with configuration files, or large. Since this is fairly large topic I will split it into multiple parts.
So let’s say I need to set my ssh. So my first journey goes to
/etc. Okay let’s open
/etc/ssh. New file? Oh god. Fine. I can try
/etc/ssh/ssh. I am smarter than before and actually press tab. So there is
sshd_config. Sshd surely stands for daemon, ssh for client. But why exactly there is one more directory? (I expected that .d stands for directory) And that’s just the tip of the iceberg!
Some configurations are stored simply in
/etc/appname. But some don’t even mention that they are in a directory with
appname.d. They just make other names like X.org is using
Now let’s take a look at systemd. Do you know where your systemd unit files are located? Pick one:
/etc/systemd/system.control/* /run/systemd/system.control/* /run/systemd/transient/* /run/systemd/generator.early/* /etc/systemd/system/* /etc/systemd/systemd.attached/* /run/systemd/system/* /run/systemd/systemd.attached/* /run/systemd/generator/* /usr/lib/systemd/system/* /run/systemd/generator.late/*
Correct answer? All of them! You want to know fun fact? These are only system unit file locations. User unit files can be in these directories:
~/.config/systemd/user.control/* $XDG_RUNTIME_DIR/systemd/user.control/* $XDG_RUNTIME_DIR/systemd/transient/* $XDG_RUNTIME_DIR/systemd/generator.early/* ~/.config/systemd/user/* /etc/systemd/user/* $XDG_RUNTIME_DIR/systemd/user/* /run/systemd/user/* $XDG_RUNTIME_DIR/systemd/generator/* ~/.local/share/systemd/user/* /usr/lib/systemd/user/* $XDG_RUNTIME_DIR/systemd/generator.late/*
In Linux each user can have their own configs in their home folder. These configurations will override system-wide settings. Someone
thought that these files normal people don’t want to see when opening their home directory. They thought “Let’s add
. to the beginning of each directory/file we want to hide.” Yeah, right, I can’t express how stupid this idea was.
Take a look into my home directory:
There are 19
.files! 19 and I am using very few programs. But somehow there are empty files between them! Or directories that are automatically created by programs that aren’t installed on my system anymore. Like for example
.qmmp. There are also files that contain a single line. For example my
That’s literally it! Single line and it’s a commented! Why this file exists? Or
.bash_profile contains if
.bashrc exists, run
.bashrc. This is absolute madness. And why exactly has Firefox a directory called
.mozzila in my home? In it there’s some gibberish and if you delete it? Whole Firefox doesn’t know you anymore. You are dead to it.
And we even didn’t get to the juicy part. Remember earlier when I was talking about system-wide configuration files being located
/etc/appname.d/. To call all the folders in the
.d would be too logical. Instead freedesktop folks decided that we will call all the folders inside
appname/. Funny thing is naming it these folders isn’t consistent either! i3 uses
.config/i3/config file but fish
.config/fish/config.fish. How is this any better?
This is just a first part, because as it looks this post would be thousand lines long and I wouldn’t be finished. In the next one we will take a look to the insides of these files.
Sources: systemd locations xdg_data_home