Linux

Where Are Linux Config Files Stored?

User settings live in ~/.config, data in ~/.local/share and system-wide config in /etc, plus the dotfiles that predate the standard.

Last updated

Most Linux programs keep user settings in ~/.config, the default for the XDG_CONFIG_HOME environment variable. Data that is not configuration, such as save games or local databases, belongs in ~/.local/share (XDG_DATA_HOME), and settings that affect the whole machine live in /etc.

That is the tidy picture from the XDG Base Directory Specification. Plenty of older programs ignore it and drop dotfiles straight into your home folder instead: ~/.bashrc, ~/.vimrc, ~/.gitconfig. Run ls -a ~ to see them all, since a plain ls hides anything starting with a dot.

The split matters when you edit. Anything under /etc affects every user and needs sudo, while your own ~/.config never does, which makes it the sensible place to experiment.

Where Linux stores this, by platform

Linux
~/.config

The default value of XDG_CONFIG_HOME, one config directory per program inside it. Check whether yours is overridden with echo $XDG_CONFIG_HOME: it is usually empty, which means programs fall back to ~/.config. Nothing here needs sudo. Older programs skip this folder entirely and keep dotfiles in $HOME, so run ls -a ~ when a file is not where you expected.

Linux
~/.local/share

The default for XDG_DATA_HOME: user data that is not configuration, such as save files, downloaded content and local databases. The same spec defines ~/.local/state for logs and history and ~/.cache for caches, and those three exist to keep $HOME from filling up.

Linux
/etc

System-wide configuration for every user and every service, and editing it requires sudo. XDG puts its own system defaults in /etc/xdg, while distro packages keep conventional trees here for ssh, sudo, fonts and the rest. Exact layouts vary by distribution, so check your distro's documentation when a file matters system-wide.

Frequently asked questions

Where are config files stored in Linux?

In ~/.config by default, which is where XDG_CONFIG_HOME points when the variable is not set. Confirm with echo $XDG_CONFIG_HOME. Configuration that applies to the whole system belongs in /etc instead, and that is the only part that needs sudo to change.

What is the difference between .config and .local share?

~/.config holds settings files an app reads at startup. ~/.local/share (XDG_DATA_HOME) holds data the app generates, like databases and downloaded content. Caches belong in ~/.cache and logs or history in ~/.local/state, per the same XDG specification.

Why does my home folder have so many dotfiles?

Because plenty of programs never adopted the XDG standard and write straight into $HOME, and a few like ~/.bashrc and ~/.vimrc are meant to live there. Run ls -a ~ to list them; the ArchWiki XDG Base Directory page tracks which apps support the standard and the workarounds for those that do not.

Notice an outdated path? Let us know.