Why start here
Most Linux courses start with commands. People then memorise commands and get lost the moment something unfamiliar breaks. The goal of this course is the opposite: understand what the machine is doing, so that an error message becomes a clue instead of a wall. This chapter builds the picture you will keep redrawing for the rest of the course.
1. The four things a computer has
| Part | What it does | Linux shows it as |
|---|---|---|
| CPU | Runs instructions, one stream per core | lscpu, /proc/cpuinfo |
| Memory (RAM) | Fast, temporary storage for running programs | free -h, /proc/meminfo |
| Storage | Permanent data on disks and SSDs | lsblk, /dev/sda, /dev/nvme0n1 |
| Network card | Sends and receives frames | ip link, /sys/class/net |
An operating system is the software that shares these four things fairly between all the programs that want them, and stops one program from damaging another. Without it, every program would have to drive the hardware itself.
Try it
2. The kernel and the two worlds
The CPU enforces two modes. In user mode a program can only use its own memory and cannot talk to hardware. In kernel mode code can do anything. When a program wants to read a file, it executes a system call; the CPU switches to kernel mode, the kernel does the work after checking permissions, and control returns to the program.
$ strace -e trace=openat cat /etc/hostname 2>&1 | tail -4 openat(AT_FDCWD, "/etc/hostname", O_RDONLY) = 3 $ strace -e trace=openat cat /root/secret 2>&1 | tail -2 openat(AT_FDCWD, "/root/secret", O_RDONLY) = -1 EACCES (Permission denied)
strace shows system calls live. In the second command the kernel refused with EACCES: the story behind 'Permission denied' in one line.
Try it
3. What the kernel is made of
| Part | Job | You meet it when |
|---|---|---|
| Scheduler | Decides which program runs on which CPU core next | A busy server is slow: top shows who is running |
| Memory manager | Gives each process its own address space; swaps if needed | free -h, 'Out of memory' kills |
| Filesystem layer (VFS) | One interface for ext4, XFS, NFS, tmpfs... | mount, df |
| Network stack | TCP/IP, firewall hooks, sockets | ss, ip, firewalld |
| Device drivers | Talk to specific hardware | lsmod, dmesg |
The kernel itself is one program (/boot/vmlinuz-*). Linux, strictly, is the kernel. The rest (bash, systemd, the tools) is a distribution such as Red Hat Enterprise Linux (RHEL), Rocky, Fedora or Ubuntu. RHCSA tests RHEL, so you will practise on Rocky Linux, which is built from the same source.
4. Everything is a file
Linux gives almost everything a path in the filesystem, so the same tools (cat, ls, redirection) work on all of it.
| Path | What it really is | Try |
|---|---|---|
| /etc/hostname | A normal text file | cat /etc/hostname |
| /dev/sda | Your first disk (a device file) | ls -l /dev/sda (note the b: block device) |
| /dev/null | A black hole: writes vanish, reads are empty | echo hi > /dev/null |
| /proc/cpuinfo | The kernel describing your CPU, generated live | head /proc/cpuinfo |
| /proc/1234/ | Everything about process 1234 | ls /proc/self |
| /sys/class/net/ | Kernel's view of the network cards | ls /sys/class/net |
/proc and /sys are not on the disk. They are windows into the running kernel. That is why cat /proc/cpuinfo shows your current CPU and not a stored file.5. Users and privilege
The kernel identifies who is asking by a user ID (UID) and group IDs. UID 0 is root, which the kernel does not restrict. Everyone else is checked against file permissions (chapter 3). Services also run as users (nginx, chrony), so a compromised service only has that user's rights.
$ id uid=1000(student) gid=1000(student) groups=1000(student),10(wheel) $ id root uid=0(root) gid=0(root) groups=0(root)
Try it
Check yourself
Think first, type an answer if you like, then reveal.