When you press the power button, a computer is asleep and empty. How does it become a computer you can use? This is called booting. Linux keeps notes about its own start-up, so we can play detective! ๐ต๏ธ
The boot flow, step by step
- Power on. Electricity flows to the parts.
- Firmware wakes up. A tiny built-in program (UEFI or BIOS on a PC, a bootloader on a Raspberry Pi) runs first.
- Self-test. It checks the important parts. A problem shows up as beeps, lights or blinks. (A Raspberry Pi blinks its green light in a pattern!)
- Find the OS. The bootloader looks on the drive for an operating system.
- Load the kernel. The kernel, the heart of Linux, is copied into RAM and starts.
- Wake the hardware. The kernel loads drivers, then starts background helpers called services.
- Login screen, then 8. desktop! ๐
๐งช Lab 1: how long has your computer been awake?
uptime
uptime shows the time now, how long the computer has been running, how many people are logged in, and the load average.
uptime -p
The -p makes it pretty: something like up 3 hours, 12 minutes.
who -b
This shows exactly when the last boot happened. That's the moment steps 1 to 8 finished!
๐งช Lab 2: the kernel's start-up instructions
cat /proc/cmdline
When the bootloader starts the kernel, it hands it a list of instructions, called the kernel command line. You'll see things like root=..., which tells the kernel where the main drive is.
uname -r
ls /boot
uname -r shows the kernel version you are running. ls /boot shows the start-up files: kernel files (names that start with vmlinuz, or kernel on a Raspberry Pi) and initrd/initramfs files, a tiny starter system that helps the kernel get going.
๐งช Lab 3: how long did booting take?
systemd-analyze
On most modern Linux systems this prints something like:
Startup finished in 2.1s (kernel) + 6.4s (userspace) = 8.5s
- kernel is how long steps 1 to 5 took.
- userspace is how long the services and desktop took.
Then see which services were slowest:
systemd-analyze blame | head -5
๐ง If a command doesn't work:
systemd-analyzeandjournalctlneed a Linux that starts with systemd, like Ubuntu, Raspberry Pi OS or a virtual machine. In WSL or a browser terminal they may say "not found" or "failed". That's okay, so skip them.
๐ง Meet systemd. After the kernel starts, one special program called systemd becomes the "boss of start-up". It's the very first process (PID 1) and it starts all the services. Check it:
ps -p 1 -o pid,comm
๐งช Lab 4: read the kernel's diary (with a grown-up)
journalctl -b | head -20
journalctl reads the system's diary, and -b means only since this boot. If you get Permission denied, that's the OS protecting its logs. A grown-up can try it with sudo.
๐งช Lab 5: match the steps
Write the commands next to the boot steps they teach about:
| Boot step | Clue command |
|---|---|
| Kernel loaded | uname -r |
| Instructions for the kernel | cat /proc/cmdline |
| Start-up files | ls /boot |
| Boot finished | who -b |
| Services started | systemd-analyze blame |
Sleep, shut down or restart?
| Choice | What happens |
|---|---|
| Sleep | Everything stays in RAM, using a little power. Wakes quickly. |
| Shut down | Everything is saved and the computer turns fully off. |
| Restart | Shut down, then boot again. RAM is wiped clean. |
That's why restarting often fixes a slow or stuck computer!
