01
What Linux is made of: kernel, shell, distributions and licenses
It helps to picture Linux as an onion. At the center is the hardware: the CPU, memory, disks and network card. Wrapped around it is the kernel, which manages that hardware directly. Outside the kernel sits the shell (bash, for example), which interprets the commands you type, and on the very outside are the programs you actually use.
Programs never touch the hardware themselves. When one needs to read a file or send something over the network, it asks the kernel with a system call, and the kernel deals with the hardware and hands back the result. That way, even if one program goes wrong, the kernel keeps the hardware and every other program safe. Try switching the command in the scene below.
- Command
- ls /home
One command travels down through the layers to the hardware and back · lime = request, sky blue = result
The shell interprets "ls /home" and starts the program. The program never touches the disk itself; it asks the kernel with a system call (openat · getdents64). The kernel handles the hardware and passes the result back, and the shell shows it on your screen. That’s why, even when a program misbehaves, the kernel keeps the hardware and every other program safe.
Distributions: the kernel bundled with tools
Strictly speaking, "Linux" is the name of the kernel. A kernel alone isn't something you can use, so it ships bundled with a shell, command-line tools, a package manager and an installer. That bundle is called a distribution (or distro). There are two big families, and whenever their commands differ, this guide shows them side by side.
| RHEL family | Debian family | |
|---|---|---|
| Main distributions | Red Hat Enterprise Linux, Rocky Linux, AlmaLinux, Fedora | Debian, Ubuntu |
| Package format | .rpm | .deb |
| Package managers | rpm / dnf (formerly yum) | dpkg / apt |
| Admin group | wheel | sudo |
You read a kernel version like 5.15.0 as "major.minor.patch." There used to be a rule that an even minor number meant a stable release, but that rule is no longer used. Today kernel.org publishes the latest development release (mainline), stable releases (stable) and long-term support releases (longterm).
Free software and the GPL
Linus Torvalds released the Linux kernel in 1991, and many of the tools around it came from the GNU Project, started by Richard Stallman. Stallman also founded the Free Software Foundation (FSF), whose flagship license is the GPL. Anyone can use, change and redistribute a GPL program, but if you distribute a modified version, you have to release its source code under the same GPL terms. This approach, which makes sure the freedom gets passed on to the next person, is called copyleft.
| License | Key idea | Examples |
|---|---|---|
| GPL | Distribute a modified version and you must release the source under the GPL too (copyleft) | The Linux kernel (GPLv2), bash |
| LGPL | Programs that only use (link to) the library don't have to be released under the GPL | Libraries such as glibc |
| BSD, MIT, Apache | Permissive licenses with almost no obligation to release source code | Many tools and libraries |
If a question says… → pick this
- “The part that manages the hardware directly and shares resources out to programs”Kernel
- “The program that interprets and runs the commands a user types”Shell (bash, etc.)
- “Distribute a modified version and the source must be released under the same terms”GPL (copyleft)
- “Programs that link to the library have no obligation to release their source”LGPL
- “The person who started the GNU Project and the FSF”Richard Stallman
- “Free distributions compatible with RHEL”Rocky Linux, AlmaLinux
You've seen what Linux is made of. Next, let's see the order in which these layers wake up when you press the power button.
02
What happens when you power on: the boot sequence
Between pressing the power button and seeing the login screen, several stages run one after another. It's a relay race where each stage finds the next one and hands over the baton, so if you know which stage it stopped at, you also know what broke.
| Step | Stage | What it does |
|---|---|---|
| 1 | Firmware (BIOS or UEFI) | Checks the hardware and picks the device to boot from |
| 2 | Boot sector (MBR) or EFI system partition | Where the boot loader lives |
| 3 | Boot loader (GRUB2) | Shows a menu and loads the kernel and the initramfs into memory |
| 4 | Kernel + initramfs | Initializes the hardware, then uses a temporary root to find and mount the real root file system |
| 5 | systemd (PID 1) | The first process — starts services in the right order |
| 6 | Target | Once it reaches multi-user (text) or graphical, you can log in |
- Setup
- UEFI + GPT
- Result
- Made it to the login screen
From the power button to the login screen · break something and the boot stops at that stage
When you press the power button, the UEFI checks the hardware, finds the device to boot from and runs the boot loader from the EFI system partition. GRUB2 loads the kernel and the initramfs (a temporary root used until the real root file system is mounted) into memory, and the kernel starts the very first process, systemd (PID 1). Once systemd brings services up to the default target, you can log in.
BIOS/MBR and UEFI/GPT: the old way and today's way
Four names can look like a lot, but it gets simple once you sort them into two pairs. BIOS and UEFI are firmware: the program built into the motherboard that runs first when you power on. MBR and GPT are partition table formats: a table of contents at the very front of the disk that says "here's how this disk is divided." The usual old pair is BIOS + MBR, and today's pair is UEFI + GPT. What sets them apart is how they find the next stage, the boot loader.
| Old way | Today's way | |
|---|---|---|
| Firmware | BIOS | UEFI |
| Partition table | MBR | GPT |
| How it finds the boot loader | Runs the small piece of code stored in the very first sector of the disk (512 bytes), as is | Opens a small partition just for booting (the EFI system partition) and picks a boot loader file to run |
| Think of it as | Reading the note stuck inside the front cover of a book and doing what it says | Opening a "boot" folder and picking the file to run |
On Linux, the EFI system partition is usually mounted at /boot/efi. Exams love to ask about it as "where the boot loader lives when booting with UEFI."
The GRUB2 boot loader
The boot loader that gets found and run this way is GRUB2. LILO was also used in the past, but GRUB2 is the standard today. Here's the part that trips people up when you change its settings: you don't edit grub.cfg, the file that's actually read at boot, by hand. Instead, you edit the source file, /etc/default/grub, and then run grub2-mkconfig (update-grub on Ubuntu), which generates a fresh grub.cfg.
From runlevels to targets
The old init system divided system states into numbered "runlevels." systemd replaced them with targets, and it maps the old numbers to them so the old names still work.
| Runlevel | systemd target | State |
|---|---|---|
| 0 | poweroff.target | Power off |
| 1 | rescue.target | Rescue mode (administrator only, basic services only) |
| 3 | multi-user.target | Multiple users, text mode (a common default on servers) |
| 5 | graphical.target | Multiple users, graphical screen |
| 6 | reboot.target | Reboot |
You check the default target with systemctl get-default and change it with systemctl set-default. There are two modes for when something's broken. rescue.target is rescue mode: it mounts the file systems and lets the administrator in alone with a minimal set of services. emergency.target is emergency mode, which starts even less (the root file system is mounted read-only). When a wrong /etc/fstab stops the boot, you usually land in emergency mode.
If a question says… → pick this
- “Where the boot loader lives when booting with UEFI”EFI system partition (/boot/efi)
- “The standard boot loader on Linux today”GRUB2 (formerly LILO)
- “The first process the kernel runs (PID 1)”systemd
- “The systemd target that matches runlevel 3”multi-user.target
- “The target that boots to a graphical login”graphical.target (runlevel 5)
- “What to do after changing GRUB settings”Regenerate grub.cfg with grub2-mkconfig (update-grub)
In boot steps 3 and 4, the kernel found the "root file system" and mounted it. Now let's see how disks are split up and attached.
Advertisement
03
Splitting up and attaching disks: partitions, file systems and the directory structure
You can't use a new disk straight out of the box. It takes three steps. First you split the disk into sections (partitions). Then you create a format for holding files on each partition (a file system) with mkfs. Finally, you mount it at a spot in the directory tree with mount. Unlike Windows, there are no separate C: and D: drives. Every disk attaches as a branch of a single tree that starts at /.
- Partition table
- MBR
- Usable space
- 2 / 4 TiB
Split the disk platter (one full turn = the whole disk) into wedge-shaped partitions, then attach each one to a spot in the directory tree (the folders)
MBR stores the partition info in the first 512 bytes of the disk and allows up to 4 primary partitions. Need more? Turn one of them into an extended partition and put logical partitions inside it (logical ones are numbered from 5). With 512-byte sectors, anything past 2 TiB can’t be used. Each partition only becomes usable after you create a file system on it (mkfs) and attach it to a spot in the directory tree (mount).
| MBR | GPT | |
|---|---|---|
| Number of partitions | Up to 4 primary partitions (make one extended and put logical partitions inside, numbered from 5) | 128 by default |
| Disk size | Up to 2 TiB with 512-byte sectors | Disks far bigger than that |
| Booting | BIOS | UEFI (EFI system partition) |
File systems and swap
The most common Linux file systems are ext4 and XFS. Both are journaling file systems: they write the changes they're about to make into a journal first, then apply them. So even if the power suddenly goes out, the file system is less likely to get corrupted, and checking it is faster too. The RHEL family uses XFS by default. XFS is easy to grow, but think of shrinking it as practically impossible (there's only a feature that shrinks a little off the very end). Swap is disk space the system borrows for a while when memory runs short. It isn't attached to a directory; you turn it on with swapon.
/etc/fstab: where to mount at every boot
Anything you attach with the mount command is gone after a reboot. To mount it at every boot, add a line for it to /etc/fstab. Each line has six fields.
# device (or UUID) mount point fs type options dump fsck order UUID=4c2f…a91e /home xfs defaults 0 0 /dev/sdb1 /data ext4 defaults,nofail 0 2
If a disk listed here is missing, the boot stops in emergency mode (chapter 2). Add nofail to disks the system can live without. Device names like /dev/sdb1 can change depending on the order disks are plugged in, so it's safer to use the UUID, which doesn't change.
The directory structure (FHS)
On any distribution, each directory has a set job (the Filesystem Hierarchy Standard, FHS).
| Directory | What it holds |
|---|---|
| /etc | System configuration files |
| /home | Regular users' home directories (/root is the administrator's home) |
| /var | Data that keeps changing, like logs (/var/log), mail and caches |
| /tmp | Temporary files anyone can use (Sticky Bit, chapter 5) |
| /usr | Installed programs and libraries (these days /bin and /sbin are often merged into /usr/bin and /usr/sbin) |
| /opt | Add-on software installed separately |
| /boot | Kernel and boot loader files |
| /dev | Device files (/dev/sda, etc.) |
| /proc | A virtual file system that shows kernel and process information as files (it's not on disk) |
If a question says… → pick this
- “You need more than 4 primary partitions on MBR”Make one an extended partition and put logical partitions inside
- “One partition on a disk bigger than 2 TiB”GPT
- “The approach that reduces file system damage after a sudden power loss”Journaling (ext4, XFS)
- “Mount automatically at every boot”Add it to /etc/fstab
- “The directory that holds system configuration files”/etc
- “Where log files pile up”/var/log
- “A virtual file system that shows kernel information, not disk contents”/proc
Now that the disk is attached, let's look at the files on it. A file's name and its contents actually live in separate places.
Pro only
That’s the free part of this guide
The other 6 chapters are open to Pro subscribers. Each one continues with 3D visuals and “if a question says…” tips, and the last chapter lets you check yourself with a short quiz.
- 04Inodes, links and basic commands
- 05Permissions
- 06Users and groups
- 07The shell: redirection, pipes and vi
- 08Processes and signals
- 09Package and service management
PasslyExam
You have read the concept. Now test it on exam questions
PasslyExam offers original practice questions, explanations and full mock exams built around each certification’s exam guide. The explanations cover why the right option is right and why the look-alike options are wrong. Sign up to practice for free every day.