Linux has one tree that starts at / (root). Disks, USB drives and even kernel data are attached somewhere inside it. There are no drive letters.
| Path | What lives there |
|---|---|
/etc | System-wide configuration (/etc/ssh/sshd_config, /etc/hosts) |
/var | Data that changes: logs in /var/log, caches, spool files |
/home | Users' home directories (/home/asha) |
/root | Home directory of the root user |
/bin, /usr/bin | Programs for everyone (ls, cp, python3) |
/sbin, /usr/sbin | Admin programs (fdisk, sshd) |
/tmp | Temporary files, often cleared on reboot |
/opt | Optional, self-contained third-party software |
/dev | Device files (/dev/sda, /dev/null) |
/proc, /sys | Virtual files the kernel creates on the fly |
/boot | Kernel and bootloader files |
A path that starts with / is absolute. Anything else is relative to the current directory. . is the current directory and .. is its parent:
cd /var/log # absolute
cd ../lib # relative: now in /var/libThe classic idea is "everything is a file". /proc/cpuinfo looks like a text file, but nothing is stored on disk. The kernel generates it when you read it.
In interviews: "Where would you look for an app's config? Its logs?" The answers are /etc and /var/log.