From point A to point B
Point A: you use Linux from the terminal, but the inside of the system is still a black box: you do not know where each thing lives, what is eating up memory or how to diagnose a network problem. Point B: by the end of this chapter you will choose and install a distribution with sound judgment, recognize the hardware and devices, understand the directory structure, monitor processes, read the system logs and check the network configuration.
This is what an administrator does in the first five minutes in front of an unfamiliar server.
Choosing an operating system
Windows, macOS and Linux solve the same problems with different philosophies. Windows and macOS put the graphical interface for the end user first. Linux lets you choose: you can install a full desktop or no graphical environment at all, which is the norm on servers, where everything is managed from the command line.
- Desktop: Ubuntu, Linux Mint, Fedora, Deepin.
- Server: Ubuntu Server, Debian, Red Hat Enterprise Linux, Rocky Linux, AlmaLinux, SUSE Linux Enterprise.
The life cycle of a distribution
Every distribution publishes releases with support dates. Knowing them is key: a server running an unsupported release stops receiving security patches.
| Distribution | Release pace | Support |
|---|---|---|
| Ubuntu | A release every 6 months; an LTS every 2 years (April of even years) | LTS: 5 years of standard support, extendable with Ubuntu Pro |
| Debian | A stable release roughly every 2 years | About 3 years, plus 2 of Debian LTS. Branches: stable, testing and unstable (sid) |
| Red Hat Enterprise Linux | A major release roughly every 3 years | 10 years per major release |
Beta or testing releases are for trying out new features; in production you always use stable releases.
Where to install Linux today
- Physical machine: installed directly on a computer, from a bootable USB drive.
- Virtual machine: VirtualBox, VMware or KVM. Ideal for learning and for servers.
- Cloud instance: on AWS, Google Cloud or Azure you pick an image and have a server in minutes. The initial configuration is usually automated with cloud-init.
- WSL: Linux inside Windows, with no visible virtual machine.
- Containers: not a full installation, but they run a distribution's user space on top of the host's kernel. You will see this in the Docker topic.
Hardware, devices and partitions
A computer's components are the same with any system: a motherboard with its firmware (BIOS or UEFI), processor, RAM, disks (HDD, SSD, NVMe), power supply, graphics, network and sound cards, and expansion buses (PCI Express, USB, SATA). Linux manages them with drivers, most of them included in the kernel itself as modules.
lscpu # processor: model, cores, architecture
arch # architecture: x86_64, aarch64...
cat /proc/cpuinfo # processor details
free -h # RAM and swap
lsblk # disks and partitions as a tree
df -h # space used on each file system
lspci # PCI devices
lsusb # USB devices
lsmod # modules (drivers) loaded in the kernel
Devices as files
In Linux, devices appear as files inside /dev: /dev/sda is the first SATA or SCSI disk, /dev/sda1 its first partition, and /dev/nvme0n1p1 the first partition of an NVMe disk. There are also special devices: /dev/null discards data, /dev/zero produces zeros and /dev/urandom, random bytes.
Partitions
A disk is divided into partitions, and each one is mounted at a point in the directory tree. A minimal installation needs a root partition /; it is common to add swap space, which today can be a partition or simply a file, and on UEFI machines a small EFI boot partition.
sudo fdisk -l # partition table (MBR or GPT)
sudo gdisk -l /dev/sda # specific to GPT
The directory hierarchy
Every distribution organizes its directories according to the Filesystem Hierarchy Standard (FHS). That is why, on any Linux system, you know where to look.
The key directories of the FHS standard. Diagram: The House of Routing.
/etc: configuration
This is where the system configuration lives, in text files: users (/etc/passwd, /etc/group, /etc/shadow), the machine name (/etc/hostname), local name resolution (/etc/hosts) and DNS servers (/etc/resolv.conf). Many programs use directories ending in .d, such as /etc/apt/sources.list.d/, where each file adds a piece of the configuration: it is more modular and easier to maintain.
/proc and /sys: the kernel in plain sight
They do not contain real files on disk: the kernel generates them in memory. /proc shows information about processes and the system (/proc/cpuinfo, /proc/meminfo, one folder for each PID) and /sys exposes the hardware and drivers.
Processes and memory
A program is a file on disk; a process is that program running. Each process has a unique identifier, the PID, while it is alive. When it ends, its PID is freed and the system can reuse it later.
ps # processes in your terminal
ps -ef # all of them, full format
ps aux # all of them, with CPU and memory usage
pstree # tree of parent and child processes
top # live monitor (q to quit); htop is an improved version
pgrep -l nginx # PIDs of the processes that match a name
kill 1234 # asks process 1234 to terminate (SIGTERM)
kill -9 1234 # forces it (SIGKILL): last resort
free -h # memory used, free and cached
uptime # time running and load average
uptime and top is three numbers: the average for the last minute, the last 5 and the last 15. Compare it with the number of cores in your CPU: a load of 4 on a 4-core machine means it is running at its limit.Boot, services and logs
From the firmware to the login screen. Diagram: The House of Routing.
The firmware finds the boot loader (usually GRUB), which loads the kernel and the initramfs, a small in-memory file system with what is needed to mount the real disk. Then the kernel starts systemd as process 1, and systemd starts the services.
dmesg -T | less # kernel messages, with readable timestamps
systemctl status ssh # status of a service
sudo systemctl restart ssh # restarts it
sudo systemctl enable --now nginx # enables it at boot and starts it right away
Logs
Two systems coexist on many distributions:
- systemd-journald: stores logs in a structured binary format, which you query with
journalctl. It is the current standard and the one version 2.0 of the exam asks for. - rsyslog: the traditional system, which writes text files in
/var/log(syslog,auth.log…) and is configured in/etc/rsyslog.confand/etc/rsyslog.d/.
journalctl -b # logs since the last boot
journalctl -k # kernel messages only
journalctl -u ssh # a single service only
journalctl -p err # errors or more severe only
journalctl --since "1 hour ago" # last hour
journalctl -f # live
ls /var/log/ # traditional text files
Your machine on the network
To communicate on a local network and with the internet, a machine needs an IP address (IPv4, IPv6 or both) with its mask or prefix, a gateway (the router that takes it out of its network) and one or more DNS servers that translate names into addresses. They are configured by hand (static) or automatically through DHCP.
ip addr show # interfaces and IP addresses (or: ip a)
ip route show # routing table and gateway (or: ip r)
ss -tulpn # listening TCP/UDP ports and the process using them
ping -c 4 8.8.8.8 # is there connectivity?
ping -c 4 google.com # does DNS work?
tracepath google.com # which routers the traffic passes through
cat /etc/resolv.conf # configured DNS servers
resolvectl status # DNS on systems with systemd-resolved
host google.com # quick DNS lookup
dig google.com AAAA # detailed DNS lookup (here, IPv6)
hostnamectl # machine name and system details
ifconfig, route and netstat (the net-tools package) are obsolete and many distributions no longer install them. Their replacements are ip addr, ip route and ss. Version 2.0 of the exam only asks for the new ones.Persistent network configuration depends on the distribution: Netplan on Ubuntu (/etc/netplan/), NetworkManager on Fedora and RHEL (nmcli) or /etc/network/interfaces on classic Debian installations.
Linux Essentials-style challenge
Answer before you open the solution. Getting it wrong here is the cheapest way to learn.
1. In which directory do you look for the system configuration files?
In /etc. Text logs are in /var/log and programs, in /usr.
2. Which command shows the logs of a specific service on a system with systemd?
journalctl -u service-name, for example journalctl -u ssh.
3. You want to know which process is listening on port 80. What do you use?
ss -tulpn (with sudo to see other users' processes). It is the modern replacement for netstat.
4. What does /proc contain?
Kernel and process information generated in memory, not files stored on disk. For example, /proc/cpuinfo or one folder for each PID.
What you take away
- In production, stable and supported releases: LTS on Ubuntu, stable on Debian.
- Linux installs on bare metal, on VMs, in the cloud with cloud-init or on WSL.
- Devices are files in
/dev;lsblk,df,freeandlscpugive you the inventory. - FHS:
/etcconfiguration,/var/loglogs,/homeusers,/procand/systhe kernel. - A process is a running program with its PID:
ps,topandkill. - systemd starts the services;
systemctlmanages them andjournalctlreads their logs. - Modern networking:
ip,ss,ping,resolvectlanddig.
In the last chapter of the course you secure the system: users and groups, permissions, special permissions, links and remote access with SSH.
Official resources
- Filesystem Hierarchy Standard 3.0linuxfoundation.org
- Ubuntu release cycleubuntu.com
- Debian Releaseswiki.debian.org
- Red Hat Enterprise Linux Life Cycleredhat.com
- journalctlfreedesktop.org
- ip(8)man7.org
- ss(8)man7.org
Source and credits. Chapter written from Jesús Espinoza's study notes for the LPI Linux Essentials certification (2022), updated to version 2.0 of the exam (010-200). Text drafted with AI assistance; original diagrams by The House of Routing. Technical details were checked against the official documentation from LPI, GNU and the distributions.