I wholeheartedly agree with this blog post. I believe someone on here yesterday was asking about config file locations and setting them manually. This is in the same vein. I can’t tell you how many times a command line method for discovering the location of a config file would have saved me 30 minutes of googling.
@wet_lettuce
Should be /etc or /usr/local/etc or /opt/etc or /opt/vendor/product/etc or ~/etc.
With some exceptions for historic compatibility (like ~/.bashrc)
The man page should specify where.
The exceptions should only apply for cases where XDG is not available. In any other case, the appropriate XDG directoy configured by the user should be used first.
For user-specific config files, aren’t they all supposed to be in
~/.config
these days? I’ve never heard of software using~/etc
.$HOME/.config
is XDG default but if you want you canXDG_CONFIG_DIR=$HOME/etc
@dan
If you do
./configure --prefix=“$HOME” \
&& make && make test && make install
then you typically get ~/etc for the config files (and binaries in ~/bin)
~/.config is not part of any posix or Un*x standard I know of.
Some desktop environments do use it, but not because of any standard I am aware of.
I wasn’t sure if it’s a standard or not, but a bunch of stuff store config files there. At least on one of my command-line-only systems, I see configs for htop, NuGet, ookla speedtest, PowerShell, rclone, and borgbackup in there, as well as an empty procps directory. Apparently it’s part of the XDG standard, but it seems like a decent number of non-desktop apps use it too.
@dan
Oh also I think ~/.config is used primarily for configuration files that are not intended to be edited with a text editor. Many apps (e.g. Firefox) just use ~/.firefox or something similar rather than ~/.config and app specific dot directories actually makes more sense to me for GUI driven per-user configurations.