Filesystem and Paths
If you do not know where to look on a Linux host, you move slowly. Most day-to-day work starts with knowing which directory probably has the answer.
High-value paths
Section titled “High-value paths”| Path | What it usually holds |
|---|---|
/etc |
Config files |
/var/log |
Application and system log files |
/var/lib |
Persistent app state |
/var/run or /run |
Runtime state like PID files and sockets |
/usr/bin |
Most packaged user commands |
/usr/sbin |
Admin-focused packaged commands |
/usr/local/bin |
Locally installed commands |
/tmp |
Temporary files |
/home |
User home directories |
/proc |
Kernel and process view |
/sys |
Device and kernel state |
Fast checks
Section titled “Fast checks”pwdls -lahcd /etcfind /etc -maxdepth 2 -name '*nginx*'readlink -f /var/run # resolve the real path behind a symlinkwhich <command>whereis <command> # show likely binary, source, and manpage locationsWhat matters on the job
Section titled “What matters on the job”- Config usually lives in
/etc. - Logs are often in
/var/log, but many services now log straight to journald. - If a package installed a binary, it is usually in
/usr/binor/usr/sbin. - If a team dropped in a custom script, check
/usr/local/bin,/opt, or a repo checkout under/srvor/home. /procis not a normal filesystem. It is a live kernel view. Use it to inspect processes and system state.
Quick examples
Section titled “Quick examples”Find the config directory for a service:
systemctl cat <service-name> # print the full unit file and overridesFind where a running process was started from:
readlink -f /proc/<pid>/exe # show the real executable pathtr '\0' ' ' < /proc/<pid>/cmdline # show the full process command lineCommon mistake
Section titled “Common mistake”Do not assume logs are always in /var/log. On many modern systems, the real answer is journalctl -u <service-name>.