The Linux directory layout: /etc, /var, /usr explained

Know where configuration, data, logs and programs live, so you know what to edit and what to back up.

Part 4 of 12 in Linux basics for self-hosters. Last updated

In short: Configuration lives in /etc, changing data such as logs, databases and caches in /var, installed programs in /usr, your own files in /home, and runtime files that vanish at reboot in /run. On current distributions /bin, /sbin and /lib are only links into /usr. For a home server, the directories to back up are /etc, /home, /srv (or wherever your service data lives) and parts of /var/lib.

The map in one table

Linux has one tree that starts at /. Disks, USB sticks and network shares do not get drive letters; they are mounted somewhere inside that tree. The layout is standardised in the Filesystem Hierarchy Standard and, for systemd distributions, in file-hierarchy(7).

Three kinds of directories: yours, the package manager's, and the ones the system rebuilds at boot.
The top-level directories you will actually touch
DirectoryWhat lives thereYou edit it?
/etcSystem-wide configuration: fstab, ssh/sshd_config, systemd/system/Yes, this is your side
/usrInstalled programs (/usr/bin), libraries (/usr/lib), shared data and documentationNo, the package manager owns it
/usr/localPrograms and scripts you installed by handYes
/varData that changes: /var/log, /var/lib (databases, container storage), /var/cacheRarely by hand; back up /var/lib
/homeOne directory per user, with their files and personal settings (dotfiles)Yes, your own
/rootThe home directory of the root userRarely
/srvData a server serves: a good home for service data such as /srv/mediaYes
/optSelf-contained third-party software that brings its own directory treeOnly for that software
/mnt, /mediaMount points: /mnt for things you mount yourself, /media for removable mediaYes, create mount points here
/tmpTemporary files; often a tmpfs in memory that is empty after a rebootNo
/runRuntime data since boot: PID files, sockets, locks (/var/run and /var/lock point here)No
/proc, /sysVirtual files the kernel creates to show processes and hardwareRead, do not write
/devDevice files: disks (/dev/sda, /dev/nvme0n1), terminals, /dev/nullNo
/bootKernels, the initramfs and boot loader filesNo, updates manage it

Why /bin points to /usr/bin

Old guides describe /bin, /sbin and /lib as separate directories for "essential" programs. On openSUSE, Fedora, Arch, Ubuntu and Debian 12 and newer they are now symbolic links into /usr, a change called the usr merge. Check it yourself:

# openSUSE Tumbleweed
$ ls -ld /bin /sbin /lib /lib64
lrwxrwxrwx 1 root root 7 Mar  2  2026 /bin -> usr/bin
lrwxrwxrwx 1 root root 7 Mar  2  2026 /lib -> usr/lib
lrwxrwxrwx 1 root root 9 Mar  2  2026 /lib64 -> usr/lib64
lrwxrwxrwx 1 root root 8 Mar  2  2026 /sbin -> usr/sbin

# Debian 12
$ ls -ld /bin /sbin /lib /lib64
lrwxrwxrwx 1 root root 7 Jan 13  2025 /bin -> usr/bin
lrwxrwxrwx 1 root root 7 Jan 13  2025 /lib -> usr/lib
lrwxrwxrwx 1 root root 9 Jan 13  2025 /lib64 -> usr/lib64
lrwxrwxrwx 1 root root 8 Jan 13  2025 /sbin -> usr/sbin

Real output on openSUSE Tumbleweed and Debian 12, 2026-09-28; user and host names and addresses redacted.

The l at the start and the arrow mean "this is a link". A script with #!/bin/bash keeps working; it just ends up in /usr/bin/bash. One result is handy: everything the distribution installed sits under /usr, and your changes sit under /etc and /var.

Where configuration really lives

More and more packages ship their default configuration under /usr and only read /etc for your changes. That keeps updates from overwriting your edits.

  • systemd units: packages put services in /usr/lib/systemd/system/; your own units and overrides go in /etc/systemd/system/. Do not edit the file under /usr: run sudo systemctl edit sshd.service, which creates an override drop-in that survives updates.
  • openSUSE's /usr/etc: openSUSE moves many defaults, such as /usr/etc/sudoers, out of /etc. If /etc/sudoers seems to be missing, that is why. Put your changes in a new file under the matching .d directory in /etc, such as /etc/sudoers.d/.
    $ grep -E '^[^#]*targetpw' /usr/etc/sudoers /etc/sudoers
    /usr/etc/sudoers:Defaults targetpw   # ask for the password of the target user i.e. root
    grep: /etc/sudoers: No such file or directory

    Real output on openSUSE Tumbleweed, 2026-09-28; user and host names and addresses redacted.

  • Per-user settings: dotfiles in your home directory, mostly under ~/.config. User services live in ~/.config/systemd/user/.

Where podman keeps its files

Podman and quadlet paths for rootless and rootful containers
WhatRootless (your user)Rootful (root)
Quadlet files~/.config/containers/systemd//etc/containers/systemd/
Images and containers~/.local/share/containers/storage//var/lib/containers/storage/
Named volumes~/.local/share/containers/storage/volumes//var/lib/containers/storage/volumes/
Podman settings~/.config/containers//etc/containers/

podman volume inspect NAME --format '{{.Mountpoint}}' prints the exact path of a volume, and podman info shows where your own storage is:

$ podman info --format '{{.Store.GraphRoot}}  {{.Store.VolumePath}}'
/home/user/.local/share/containers/storage  /home/user/.local/share/containers/storage/volumes

Real output on openSUSE Tumbleweed, podman 6.0.2, 2026-09-28; user and host names and addresses redacted.

Write quadlets by hand, or convert a docker-compose file with the compose to quadlet converter and check the result with the systemd unit explainer.

What to back up

A reinstall gives you /usr back for free. What it cannot give you back:

  • /etc: all your system configuration, small and precious.
  • /home: including ~/.config/containers/systemd/ and rootless volumes.
  • /srv or wherever your service data lives, such as a media library.
  • The parts of /var/lib that belong to your services, such as rootful volumes and databases.

Skip /proc, /sys, /dev, /run and /tmp: they are rebuilt at every boot. Network shares usually live under /mnt; the fstab generator for NAS shares writes the line that mounts one at boot. How to copy it all safely is in rsync and tar done right.

Common mistakes

Editing a unit file under /usr/lib/systemd

It works until the next package update silently puts the original back. Use sudo systemctl edit name.service for a drop-in, or copy the unit to /etc/systemd/system/ if you want to replace it completely.

Storing service data in /tmp

On openSUSE Tumbleweed and Fedora /tmp lives in memory, so a reboot empties it. Everywhere else, systemd-tmpfiles deletes old files there on a schedule. Keep data in /srv, /var/lib or a volume.

Filling the root file system with a forgotten mount point

If a NAS share is not mounted, /mnt/nas is just an empty directory on your system disk, and a backup job will happily fill it. Check with findmnt /mnt/nas before writing, and see the disk space guide for finding what filled the disk.

Frequently asked questions

What is the difference between /usr/bin and /usr/local/bin?

/usr/bin belongs to the package manager: every file there came from a package and an update may replace it. /usr/local/bin is yours: put scripts and programs you installed by hand there, and the package manager will never touch them.

Is it safe to delete files in /tmp?

Files in /tmp are temporary by definition, but a running program may still use them, so do not empty it by hand while the system runs. On many current distributions /tmp is a tmpfs in memory and is cleared at every reboot; systemd-tmpfiles also removes old files on a schedule.

Where are log files on Linux?

Most services on a systemd distribution log to the journal, which you read with journalctl; it is stored in /var/log/journal. Some programs still write plain text files to /var/log, for example the zypper history in /var/log/zypp/history.

Why is there no lost+found directory on my system?

lost+found is created when an ext2, ext3 or ext4 file system is made, as a place for files that fsck recovers. btrfs has no such directory and XFS only creates one during a repair, so an openSUSE system on the default btrfs has none. It is not something you need to create.