RousselTMLEARNING

Article · Linux administration: from discovery to expertise

Architecture of a Linux system

1. Linux, kernel and distributions #

What we call Linux.

A kernel and an ecosystem #

Strictly speaking, Linux is a kernel: the program that manages the processor, memory, disks and network, and arbitrates programs' access to the hardware. What you install on a server is a distribution: the kernel, plus the GNU tools, a package manager, systemd and an update policy.

Linux system stack
Programs never talk directly to the hardware: they go through the kernel's system calls.

Programs run in user space; only the kernel runs in kernel space. They communicate through system calls (open, read, fork, connect...), which can be observed with strace.

Distribution families #

Linux distribution families
Knowing the family is enough to know which commands to use.
FamilyDistributionsPackagesTypical use
DebianDebian, Ubuntu.deb, aptWeb servers, cloud, workstations
Red HatRHEL, Rocky Linux, AlmaLinux, Fedora.rpm, dnfEnterprise, long-term support, certifications
SUSESLES, openSUSE.rpm, zypperEnterprise, SAP
LightweightAlpineapkContainer images
Good practice: For a server, choose a distribution with long-term support (Ubuntu LTS, Debian stable, RHEL or its clones): 5 to 10 years of security fixes.

Identifying the system #

cat /etc/os-release        # distribution et version
uname -r                   # version du noyau
hostnamectl                # nom, OS, noyau, architecture, virtualisation
lscpu ; free -h ; lsblk    # CPU, mémoire, disques

2. Booting #

From firmware to the login prompt.

The steps #

Linux boot steps
Each step hands over to the next; systemd then starts services in parallel.
  1. The firmware (UEFI) initializes the hardware and launches the bootloader from the EFI partition.
  2. GRUB offers the installed kernels and passes them options (/proc/cmdline).
  3. The kernel decompresses itself, detects the hardware and mounts the initramfs, a mini-system that loads the drivers needed to access the root disk (LVM, RAID, encryption).
  4. The root is mounted and the kernel starts systemd, process number 1 (PID 1).
  5. systemd reaches the default target: multi-user.target on a server, graphical.target on a workstation.

Inspecting the boot #

systemctl get-default                 # cible par défaut
systemd-analyze                       # durée totale du démarrage
systemd-analyze blame | head          # services les plus lents
journalctl -b -p err                  # erreurs du démarrage courant
journalctl --list-boots               # démarrages précédents
dmesg -T | tail                       # messages du noyau
Rescue mode: To repair a server that no longer boots, add systemd.unit=rescue.target (or emergency.target) to the kernel line in GRUB: you get a minimal root shell.

3. The directory tree (FHS) #

Where things are.

Directories to know #

Directory tree of a Linux system
Disks and partitions are grafted onto this single tree by mounting.
DirectoryContent
/etcSystem and service configuration (text)
/varVariable data: /var/log (logs), /var/lib (databases, state), /var/cache
/home, /rootHome directories of users and root
/usrPrograms and libraries installed by packages (/usr/bin, /usr/lib)
/opt, /usr/localSoftware installed outside the package manager
/tmpTemporary files, often cleared at reboot
/bootKernels, initramfs, GRUB configuration
/devDevice files (/dev/sda, /dev/null)
/proc, /sysVirtual file systems exposed by the kernel
/srvServed data (websites, FTP)
Good practice: Back up at least /etc, /home, /root, /srv and the application data in /var/lib: the rest can be reinstalled from packages.

Everything is a file #

Linux exposes almost everything as files: devices, kernel information, parameters. You read the system state with cat and often change it with echo or sysctl.

cat /proc/cpuinfo | grep 'model name' | head -1
cat /proc/meminfo | head -3
cat /proc/loadavg
cat /sys/class/net/eth0/address      # adresse MAC
sysctl net.ipv4.ip_forward           # paramètre noyau
ls -l /proc/$$/fd                    # descripteurs ouverts par le shell courant

4. Finding documentation #

Finding the answer on the machine.

Built-in help #

man 5 fstab          # section 5 : formats de fichiers
man -k partition     # chercher une page de manuel
ssh --help | less    # aide courte
help cd              # commandes internes de bash
type ls ; which -a python3
apropos firewall
man sectionContent
1User commands
5Configuration files
8Administration commands

📄 Linux system architecture: kernel, boot and directory tree →

My progress

  • ⏱ Estimated time : ≈ 7 min

Sign in to track your progress and take notes. Sign in

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Linux vs Unix: the complete guide to commands and distributions

Understand the differences between Linux and Unix, explore distributions (server, desktop, lightw...

Linux administration best practices

Checklist for administering Linux servers: accounts and sudo, SSH, updates, systemd services, sto...

Packages, systemd services, logs and scheduled tasks

Install and update software with apt and dnf, manage services with systemctl, write a systemd uni...

Storage on Linux: disks, partitions, file systems and LVM

Administer Linux storage: lsblk and blkid, GPT partitioning, ext4 and XFS, mounting and /etc/fsta...

Users, groups, sudo and permissions on Linux

Manage Linux accounts (useradd, usermod, passwd, chage), groups, sudo and visudo, rwx and octal p...

Networking on Linux: configuration, diagnosis, firewall and SSH

Configure and troubleshoot Linux networking: ip, ss, netplan and NetworkManager, DNS, layered dia...

Linux server security and hardening

Harden a Linux server: least privilege, updates, secure SSH, firewall, fail2ban, SELinux and AppA...

Backup, monitoring and troubleshooting of a Linux server

Operate a Linux server day to day: 3-2-1 backup strategy with rsync, tar, LVM snapshots and resti...

The Bash shell and files: navigation, redirections, pipes and text processing

Master the Linux command line: paths, file handling, wildcards, redirections, pipes, searching wi...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!