ubuntu, updated
Where is what? The folder layout
What lives in /etc, /var, /home, /opt and the other top-level folders, and where to look for configs, logs and data.
The top-level folders
Every Linux system follows roughly the same layout (the Filesystem Hierarchy Standard). Once you know it, you know where to look on any server.
| Folder | Contains | You go there for |
|---|---|---|
/etc | System-wide configuration (text files) | Changing settings |
/var/log | Log files | Troubleshooting |
/var/lib | Program data: databases, Docker, package state | Finding app data |
/home/USER | Users’ personal files | User data |
/root | Home folder of root | |
/srv | Data served by this server (websites, shares) | Your own service data |
/opt | Third-party software installed outside apt | Vendor apps |
/usr/bin, /usr/sbin | Installed programs | |
/usr/local | Software you compiled or installed by hand | Your own scripts (/usr/local/bin) |
/tmp | Temporary files, cleaned on reboot | |
/boot | Kernel and boot loader | Rarely, careful |
/dev, /proc, /sys | Devices and live kernel info (virtual) | See Everything is a file |
/mnt, /media | Mount points for temporary / removable disks | Mounting |
/run | Runtime data (PIDs, sockets), gone on reboot |
On current Ubuntu, /bin, /sbin and /lib are just links into /usr.
Configs you will touch most
| File / folder | Controls |
|---|---|
/etc/netplan/*.yaml | Network (Netplan) |
/etc/fstab | Disks mounted at boot (Format and mount) |
/etc/hosts, /etc/hostname | Local name resolution, server name |
/etc/ssh/sshd_config (+ sshd_config.d/) | SSH server |
/etc/sudoers.d/ | Who may use sudo (Who is sudo?) |
/etc/passwd, /etc/group | Users and groups (Users) |
/etc/apt/sources.list.d/ | Package sources |
/etc/systemd/system/ | Your own service units and overrides |
The .d folders
Many programs read a main config plus every file in a matching .d folder, for example /etc/ssh/sshd_config.d/. Put your changes in your own file there instead of editing the main file. Package updates then won’t overwrite your settings, and you can see at a glance what you changed.
Logs
Logs are in the systemd journal (journalctl) and in /var/log. Which log holds what: Where are the logs?