FoundationLesson 1 of 4 in Linux FundamentalsFree preview

File System Hierarchy

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.

PathWhat lives there
/etcSystem-wide configuration (/etc/ssh/sshd_config, /etc/hosts)
/varData that changes: logs in /var/log, caches, spool files
/homeUsers' home directories (/home/asha)
/rootHome directory of the root user
/bin, /usr/binPrograms for everyone (ls, cp, python3)
/sbin, /usr/sbinAdmin programs (fdisk, sshd)
/tmpTemporary files, often cleared on reboot
/optOptional, self-contained third-party software
/devDevice files (/dev/sda, /dev/null)
/proc, /sysVirtual files the kernel creates on the fly
/bootKernel 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/lib

The 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.

Practice

Solve 3 of 4 to complete this lesson.

0/4 solved

Solve 3 more to complete this lesson, or move on and come back later.

Skip to next: Users and Groups