How Linux boots
- Firmware (BIOS/UEFI) runs the power-on self test and finds a boot device.
- Bootloader (GRUB) loads the kernel and the initial RAM disk.
- Kernel initialises hardware, mounts the root filesystem using drivers from
initramfs. - systemd (
/sbin/init) starts services in order and brings the system to its target (multi-user or graphical).
Kernel space vs user space
The kernel runs in privileged mode and manages processes, memory, device drivers and filesystems. Programs run in user space with least privilege and ask the kernel for work through system calls.
Files every admin should know
| Path | What it controls |
|---|---|
/etc/passwd · /etc/shadow | User accounts · password hashes (root only) |
/etc/group | Groups and members |
/etc/sudoers | Who can run commands as root (edit with visudo) |
/etc/hosts · /etc/resolv.conf | Local name overrides · DNS servers |
/etc/fstab | Filesystems mounted at boot |
/etc/netplan/*.yaml | Network configuration (Ubuntu) |
/etc/ssh/sshd_config | SSH server settings |
/etc/crontab · /var/spool/cron/ | Scheduled tasks |
/etc/systemd/system/ | Custom and overridden service units |
/var/log/ | System, auth and application logs |
~/.bashrc | Shell environment and aliases |
A typo in /etc/fstab or /etc/sudoers can stop a server booting or lock you out. Back up first and validate (mount -a, visudo -c).
Health-check commands
Run these first when you log in to a server that “feels slow” or after an alert.
uptime # load average and how long it has been up
top # live CPU / memory per process (or htop)
free -h # memory and swap
df -h # disk usage per filesystem
lsblk # disks, partitions and LVM volumes
ss -tulpn # listening ports and owning process
ip addr # interfaces and IPs
systemctl --failed # services that failed to start
journalctl -xe # recent errors with explanations
journalctl -p err -b # all errors since boot
Permissions in one minute
-rwxr-x--- = owner can read/write/execute, group can read/execute, others nothing. In numbers: r=4, w=2, x=1, so that's 750.
chmod 640 /etc/app/config.yml
chown appuser:appgroup /var/www/app -R
sudo -l # what can I run with sudo?
Scheduling with cron
A cron line has five time fields followed by the command.
┌──────── minute (0–59)
│ ┌────── hour (0–23)
│ │ ┌──── day of month (1–31)
│ │ │ ┌── month (1–12)
│ │ │ │ ┌ day of week (0–7, 0 and 7 = Sunday)
│ │ │ │ │
30 2 * * 1-5 /opt/scripts/backup.sh >> /var/log/backup.log 2>&1
* any value* * * * * runs every minute, list0 9,17 * * * at 09:00 and 17:00- range0 9 * * 1-5 weekdays at 09:00/ step*/15 * * * * every 15 minutesCron explainer
Managing crontabs
crontab -e # edit your crontab
crontab -l # list it
crontab -u alice -l # another user's crontab (root)
crontab -r # remove it (careful!)
Storage: LVM & RAID
LVM — flexible volumes
These commands modify disks. Practise on a disposable lab disk and double-check device names with lsblk.
lsblk
sudo pvcreate /dev/sdb
sudo vgcreate vg_data /dev/sdb
sudo lvcreate -L 10G -n lv_backup vg_data
sudo mkfs.ext4 /dev/vg_data/lv_backup
sudo mkdir -p /backup
sudo mount /dev/vg_data/lv_backup /backup
# Grow it later by 5 GB, filesystem included
sudo lvextend -r -L +5G /dev/vg_data/lv_backup
sudo pvs; sudo vgs; sudo lvs
RAID levels
| RAID | Min disks | Method | Survives | Usable (4 × 1 TB) |
|---|---|---|---|---|
| 0 | 2 | Striping | No failures | 4 TB |
| 1 | 2 | Mirroring | 1 disk per mirror | 2 TB |
| 5 | 3 | Distributed parity | 1 disk | 3 TB |
| 6 | 4 | Dual parity | 2 disks | 2 TB |
| 10 | 4 | Mirror + stripe | 1 per mirror pair | 2 TB |
RAID is not a backup. It doesn't protect against deletion, ransomware, corruption, theft or site disasters.
Services & troubleshooting
systemd essentials
sudo systemctl status nginx
sudo systemctl start|stop|restart|reload nginx
sudo systemctl enable --now nginx # start now and at boot
journalctl -u nginx --since "1 hour ago"
systemctl list-units --type=service --state=running
A service failed to start
systemctl status <service>— read the last log lines.journalctl -u <service>— see the full error.- Validate the configuration (
nginx -t,sshd -t,apachectl configtest). - Check dependencies, permissions, ports in use (
ss -tulpn) and free disk space. - Apply a controlled fix, restart and verify.
Disk is 100% full
df -h # which filesystem?
sudo du -xh / --max-depth=1 | sort -h # which directory?
sudo find /var/log -size +100M # big logs
sudo journalctl --vacuum-size=500M # shrink the journal
sudo lsof +L1 # deleted files still held open
Find out what a file is and who owns it before deleting it. Then expand storage or set up log rotation so it doesn't happen again.
Infographics
Click to open full-size. Use ← → to browse, click the image to zoom.
Documents
PDFs open in a new tab. A tick appears on the ones you've opened.