Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Linux fundamentals

By updated

Improve this page

Linux is a free and open source operating system. Strictly speaking, it is the kernel Linus Torvalds created in 1991: the central program that manages the hardware, the memory and the processes. In everyday use, "Linux" means a complete system put together by a distribution (Ubuntu, Debian, RHEL), which adds the libraries, tools and applications around the kernel.

This guide gives you the essential vocabulary and landmarks to work on a Linux server: how the system is organised in layers, how its filesystem (the way files are laid out on disk) is structured, and how it boots. It is the groundwork of the Fundamentals part of the course: these notions come back in every guide of the section.

What you will learn

By the end of this guide, you will be able to:

  • explain in what sense Linux is a kernel and what distributions add around it,
  • describe how a simple command such as ls travels from the user layers down to the kernel,
  • name the 7 boot stages of a modern Linux server, from UEFI to systemd,
  • find your way around the / tree without hesitating over where a configuration file, a log or a script belongs.

What is Linux?

The Linux kernel is distributed under the GPL licence (a free licence: anyone may study, modify and redistribute the code). It is what manages the hardware, the memory, the processes and the files.

In everyday use, people say "Linux" to mean a complete system. That system is actually provided by a distribution, which bundles:

  • the Linux kernel,
  • system libraries (including the libc),
  • GNU utilities and other tools,
  • an init system (most often systemd),
  • a package manager (APT, DNF, APK…),
  • and additional applications.

Common distributions in server administration: Ubuntu Server, Debian, RHEL/Rocky Linux, Alpine Linux.

The package manager depends on the distribution family: apt on Debian and Ubuntu, dnf on RHEL and its derivatives AlmaLinux and Rocky Linux, apk on Alpine.

This split of roles explains the name GNU/Linux some people use. Linus Torvalds wrote the kernel; Richard Stallman and the GNU project provided most of the tools around it: compiler, shell and utilities. A distribution combines both, and much more, into a system you can actually use.

The components of a Linux system

A Linux system is not a single block but a stack of bricks, each one resting on the ones below it. The table below lists these bricks, starting from the hardware. Above all, remember the Role column: when something breaks, it tells you which brick to question. A service that will not start belongs to init. A command that is not found comes from a typo or a missing package: in the second case, the package manager installs it.

ComponentRoleExample
KernelManages hardware, memory, processesLinux 6.12 (Debian 13), Linux 7.0 (Ubuntu 26.04)
LibrariesInterface between programs and the kernelglibc, musl
ShellInterprets commandsbash, zsh, sh
System toolsHandle files, networking, processescoreutils, util-linux
Package managerInstallation and updatesapt, dnf, apk
Init / PID 1Starts and supervises services (first process of the system)systemd

Everything that runs on top of the kernel (libraries, shell, system tools, applications) forms the user space, also called userland. The kernel itself is not part of it.

How is a Linux system built?

Rather than a list of abstract layers, let's start from a concrete example.

You type ls /etc in a terminal:

  1. The shell (bash, zsh…) parses the line and locates the ls program.
  2. The shell starts ls as a new process (a program being run).
  3. ls calls functions of the C library (glibc) to read the directory.
  4. The libc turns these calls into system calls, requests addressed to the kernel (openat, getdents64…).
  5. The kernel receives these calls, queries the filesystem, and reads the entries on disk.
  6. The kernel hands the entries back to ls, which writes them to the terminal itself.

The diagram below shows the first five steps, from the typed line to the disk. Step 6 is not drawn there: the data the kernel read goes back to ls through the C library, and ls writes it straight to the terminal, without going back through the shell. Look at the "system call" arrow: it crosses the border between user space, where your programs run, and the kernel.

Path of the ls /etc command, from top to bottom. In user space: the shell parses the line, starts the ls process, which calls the C library. An arrow, a system call, crosses the border into the kernel. In the kernel: the openat and getdents64 system calls, then the file system that reads the entries on disk.     ① Shell     parses the line, finds ls     ② ls process     started by the shell③ C library (glibc)directory-reading functions④ System callsopenat, getdents64 system call      ⑤ File system     reads the entries on diskUser spaceKernelshell that receives the commandstarted program, or file systemlayer that relays the callthe request goes down to the kernel
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

This path illustrates the fundamental rule: the shell is not Linux. It is an ordinary user program. Linux is the kernel that arbitrates access to resources.

Because it is an ordinary program, several shells exist, and they do not all accept the same syntax. The commands of this course are written for bash, the default shell of Debian, Ubuntu and RHEL. zsh accepts most of them, with a few differences. fish, the default on some distributions such as CachyOS, is not compatible with bash syntax: it writes set name value where bash writes name=value, and it closes its loops with end instead of do … done.

To find out which shell you are using, type echo $SHELL: the command prints your login shell.

Terminal window
echo $SHELL
# /bin/bash on Debian, Ubuntu or RHEL
# /usr/bin/fish on a distribution that chose fish

If the printed path does not end with bash, type bash to open a bash shell for the exercises, then exit to return to yours. In that bash shell, echo $SHELL still prints your login shell, not bash: this is expected, the test did not fail.

Kernel mode and user mode

Linux constantly separates two zones:

  • Kernel mode: the kernel runs with full access to the hardware. A bug here can freeze the whole system.
  • User mode: all your processes (shell, services, applications) run with restricted privileges. A crash in this space does not bring the kernel down, except that of PID 1, whose death triggers a kernel panic.

A program asks the kernel for something only through a system call: it is the mandatory crossing point between the two modes, and the central protection mechanism of the Linux architecture.

Four confusions to clear up right away

These four shortcuts come up with people who are just starting out, and each one leads to a specific diagnostic mistake. Clearing them up now saves you from looking in the wrong place when something breaks.

  • Linux is not a distribution: Debian, Ubuntu and RHEL are distributions, and Linux is the kernel they ship.
  • The shell is not the terminal: the terminal displays and forwards your keystrokes, the shell interprets the line.
  • /proc and /sys are not real data directories: they are virtual views of the kernel, computed when you read them.
  • /tmp is not durable storage: never assume its content survives a reboot. Data that must last is written to a persistent location, such as /var or a home directory under /home, never to /tmp or /run.

How does a Linux server boot?

On a modern Linux server, booting follows a precise sequence of 7 stages. Knowing it lets you diagnose a server that will not boot, or understand why a service does not start.

The diagram below puts the seven stages in order, from the power button to the services. Look at the two stages with a thick outline, the initramfs and the services: they are where you will most often have to step in. A driver or a volume that cannot be found blocks the server at the initramfs, before the real system is even mounted. A failed service shows up at the last stage, when the rest of the system has started.

The seven boot stages of a Linux server, from top to bottom: BIOS or UEFI firmware, GRUB or systemd-boot boot loader, Linux kernel, initramfs that finds and mounts the real root, switch to the real root, systemd as PID 1, then services. The initramfs and the services have a thick outline.① BIOS or UEFI firmwaretests the hardware, starts the loader② GRUB or systemd-boot loaderloads the kernel and the initramfs③ Linux kernelinitialises the hardware④ initramfsfinds and mounts the real root⑤ Switch to the rootswitch-root⑥ PID 1: systemdfirst user program⑦ Servicesnetwork, SSH, loginmotherboard programboot stephands over to the next one
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %
  1. Firmware (BIOS / UEFI)

    At power-on, the firmware (the motherboard's program: BIOS, or UEFI on recent machines) initialises the hardware (CPU, RAM, disks, network cards), then hands over to a boot loader. On a UEFI system with Secure Boot turned on, the checks form a chain of trust: the firmware verifies the signature of the first loader (most often shim, signed in a way the firmware recognises), then shim or GRUB verifies that of the kernel. A modified link is refused before it runs.

  2. Boot loader (GRUB2 / systemd-boot)

    The boot loader displays a menu, lets you pick one kernel among those installed, or pass parameters. It loads two things into memory: the compressed Linux kernel (vmlinuz) and an initramfs image.

    Installing a kernel does not make it run. A machine can host several kernels at the same time, and the one that runs is not necessarily the newest. You will type these three commands yourself after the lesson on the terminal; for now, read what their outputs reveal. They compare what is installed with what is running. ls lists the kernel files of /boot, readlink prints the target of a symbolic link (a file that is only a shortcut to another location), and uname -r gives the version of the kernel currently running:

    Terminal window
    ls /boot/vmlinuz*
    readlink /boot/vmlinuz
    uname -r

    Here is the result on a freshly installed Ubuntu 26.04. Only one kernel is installed, /boot/vmlinuz points to it, and uname -r answers the same version. The vmlinuz.old link already exists and, for now, points to the same file. The first three lines come from ls, the fourth from readlink and the last from uname -r:

    Output (Ubuntu 26.04, kernel 7.0.0-43-generic)
    /boot/vmlinuz
    /boot/vmlinuz-7.0.0-43-generic
    /boot/vmlinuz.old
    vmlinuz-7.0.0-43-generic
    7.0.0-43-generic

    On Ubuntu, after a kernel update, two versions coexist in /boot: vmlinuz points to the newest and vmlinuz.old to the previous one. As long as the machine has not rebooted, uname -r still answers the previous version. These links are not universal: on Debian 13 and on AlmaLinux 10.2, tested the same way, readlink /boot/vmlinuz returns nothing and ls lists only the vmlinuz- file followed by the version. Compare uname -r with the vmlinuz-* files of /boot instead. In every case, /proc/cmdline confirms which one actually booted. The -o option of grep prints only the part of the line that matches the pattern, here BOOT_IMAGE= followed by the characters up to the first space:

    Terminal window
    grep -o 'BOOT_IMAGE=[^ ]*' /proc/cmdline
    Output (Ubuntu 26.04, kernel 7.0.0-43-generic)
    BOOT_IMAGE=/boot/vmlinuz-7.0.0-43-generic

    The file named by BOOT_IMAGE is the one that runs. When it differs from the newest kernel present in /boot, an installed kernel is not running yet, for lack of a reboot. This explains why a kernel security update has no effect until the machine reboots, unless the fix is applied live (livepatch), and why compliance tools distinguish "patched" from "rebooted".

  3. Kernel decompression and initialisation

    The kernel decompresses itself, detects the available hardware and takes control of the CPU. It does not mount the real root of the system yet.

  4. Initramfs / initrd

    The initramfs (Initial RAM Filesystem) is a compressed archive loaded into memory. It contains a minimal environment, drivers, scripts and tools, that lets the kernel:

    • load the drivers it needs: RAID (several disks combined into one), LVM (logical volumes, flexibly carved out of the disks) or encryption,
    • find and prepare the real root partition,
    • decrypt the volume if needed.

    The kernel starts the first program of this archive, /init, which becomes PID 1 (the first process of the system). This is the stage people often forget, but it is critical: without an initramfs, the kernel would generally not know how to reach an LVM or encrypted disk.

  5. Switch-root to the real root

    Once the real / partition is reachable, the initramfs program performs a switch-root: it leaves the initramfs environment and switches to the real filesystem installed on disk.

  6. PID 1, systemd (or another init)

    After the switch-root, PID 1 becomes the init of the real root: the process number does not change, the program does. On Debian, Ubuntu, RHEL and their derivatives, it is systemd (Alpine Linux uses OpenRC). It manages everything that follows.

  7. Services and the default target

    systemd reads its units, the files that describe each service or group of services (.service, .target, .socket…), and starts the services while honouring their dependencies. The default target (multi-user.target on a server without a graphical interface) decides which set of services is active once boot is complete.

Knowing this sequence pays off mostly on the day it stops. A failure at the initramfs stage and a failed service at the systemd stage are not handled in the same place. Knowing which of the 7 stages failed lets you target the diagnosis instead of guessing.

What is the Linux filesystem hierarchy (FHS)?

Linux organises all its data in a single tree, defined by the Filesystem Hierarchy Standard (FHS). Everything starts from the root /. These are the main directories to know:

  • Répertoire/ (root, starting point of the whole tree)
    • Répertoireetc/ configuration files for the system and services
      • …
    • Répertoirevar/ persistent variable data (logs, service state…)
      • …
    • Répertoireusr/ programs, libraries and documentation
      • …
    • Répertoirehome/ users' home directories
      • …
    • Répertoireboot/ kernel, initramfs, boot loader
      • …
    • Répertoiretmp/ temporary files, do not assume they persist
      • …
    • Répertoirerun/ volatile runtime data (reset at boot)
      • …
    • Répertoireproc/ virtual view of the kernel and processes
      • …
    • Répertoiredev/ representation of the devices
      • …

Remember three reflexes first; they cover most of the daily searches on a server:

  • looking for a configuration starts in /etc/;
  • analysing a problem starts in /var/log/;
  • finding a runtime file starts in /run/: the PID file that holds the number of a running process, or the socket, the contact point through which two programs talk to each other.

The FHS directory tree guide then details each area, with the differences between distributions and the commands to check them. It is meant to be read after the guides on shells and commands, once these landmarks are in place. To continue the course, first open Open a terminal and understand the prompt: you will type your first commands there.

Put it into practice

These landmarks stick by practising, not by rereading the guide. Do the lab after the lesson Open a terminal and understand the prompt, where typing commands is taught: the scenario does not give them, but the lab hints supply each one, at the cost of a few points. The lab prepares a separate working folder on your machine, with a file to fill in. You run the commands on your own machine to find the kernel version, the distribution identifier, one file in /etc and one file in /var/log, then write these four values into the file. The validation compares them with the real state of your system: an invented value fails.

Key points

  • Linux, strictly speaking, is a kernel. A distribution combines this kernel with libraries, tools and an init system into a usable system.
  • The shell is an ordinary user program. A program asks the kernel for something only through a system call.
  • A modern boot goes: firmware → boot loader → kernel → initramfs → switch-root → PID 1 / systemd → services.
  • The initramfs prepares the real root before the switch-root, which matters most on LVM, RAID or an encrypted volume.
  • Installing a kernel does not make it run: uname -r and BOOT_IMAGE in /proc/cmdline tell you which one is running, and only a reboot activates an updated kernel.
  • The FHS defines a standard tree: /etc for configuration, /var for variable data, /usr for programs, /boot for booting. The FHS directory tree guide details each area.

Knowledge check

Check that the essentials of this guide stuck. The questions cover only what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer

FAQ: frequently asked questions

These questions come up often when people discover Linux: what a distribution is, what the kernel does, how the system boots, what processes, services, users and files are.