Linux has no drive letters. Everything — disks, USB sticks, network shares, even running processes — appears somewhere under a single root directory called /. The layout is standardised by the Filesystem Hierarchy Standard (FHS), which is why a configuration file on Ubuntu is in the same place as on Fedora. This lesson maps out the important directories so you always know where to look, and explains absolute and relative paths.
Windows has C:\ and D:\; Linux has only /. Additional disks are mounted onto directories inside the tree, so a second drive might appear as /data or /mnt/backup. Paths use forward slashes, are case-sensitive (Readme.md and readme.md are different files), and there is no file extension requirement — the system determines file types by content, not by name.
ls /bin dev home lib64 mnt proc run snap sys usr
boot etc lib media opt root sbin srv tmp var| Directory | Contents | Example |
|---|---|---|
| /home | One subdirectory per normal user | /home/alice/projects |
| /root | Home directory of the root user | /root/.bashrc |
| /etc | System-wide configuration, plain text | /etc/ssh/sshd_config, /etc/hosts |
| /var | Variable data: logs, caches, databases, mail | /var/log/syslog, /var/lib/mysql |
| /tmp | Temporary files, usually cleared on reboot | build artefacts, sockets |
| /usr | Installed programs and their libraries | /usr/bin/python3, /usr/lib |
| /opt | Optional third-party software in its own folder | /opt/google/chrome |
| /srv | Data served by this machine | /srv/www |
/etc was historically "et cetera" but is best remembered as "editable text configuration". Almost every service you install drops a file or directory there, and most administrative work is editing those files.
/bin, /sbin, /lib: essential binaries and libraries. On modern distributions these are symbolic links to /usr/bin, /usr/sbin and /usr/lib (the "usr merge"), so ls -l /bin shows bin -> usr/bin./boot: the kernel (vmlinuz-*) and bootloader files. Do not delete anything here./dev: device files. /dev/sda is the first disk, /dev/null discards anything written to it, /dev/urandom produces random bytes./proc and /sys: virtual filesystems generated by the kernel. cat /proc/cpuinfo shows CPU details; /proc/<pid>/ describes a running process. Nothing here is on disk./run: runtime state since boot, such as PID files and sockets./mnt and /media: conventional mount points for manual and removable media.cat /proc/meminfo | head -3 # memory stats straight from the kernel
ls -l /dev/null # crw-rw-rw- ... /dev/null (c = character device)
echo "gone" > /dev/null # output vanishesAn absolute path starts with / and means the same thing regardless of where you are. A relative path is interpreted from your current working directory. Two special names exist in every directory: . is the directory itself and .. is its parent.
pwd # /home/alice
cd projects/api # relative: /home/alice/projects/api
cd ../../ # up two levels: /home/alice
cd /etc/nginx # absolute
cd ~/projects # ~ expands to /home/alice
cd - # jump back to /etc/nginxUse absolute paths in scripts, cron jobs and configuration files, because those run from directories you do not control. Use relative paths interactively to save typing.
Any file or directory whose name starts with . is hidden from a plain ls. Your home directory is full of them: .bashrc, .ssh/, .gitconfig, .config/. Show them with ls -a. They are ordinary files; the dot is just a naming convention that tools respect.
ls -a ~
ls -ld ~/.ssh # -d lists the directory itself instead of its contents/etc/<service>, logs in /var/log/<service>, data in /var/lib/<service>, binary in /usr/bin or /usr/sbin./tmp; many systems wipe it on reboot or after a few days.df -h / shows how full the root filesystem is; /var/log and /var/cache/apt are the usual culprits when it fills up.cd /e, press Tab, and let the shell finish /etc/.Where would you expect to find the configuration file for the SSH server?
/; other disks are mounted onto directories inside it./etc, logs and data in /var, programs in /usr, user files in /home./proc, /sys and /dev are interfaces to the kernel and hardware, not ordinary storage./; relative paths use . and .. from the current directory.. are hidden; ls -a reveals them.Next lesson: Navigating the Filesystem: pwd, ls, cd — put the map to use by moving around the tree and listing what is in each directory.