Back to commands

Linux Survival Basics

Read-only

Find Slow Services During Boot

A server comes back after reboot, but boot time feels long and there is no obvious culprit.

Command

systemd-analyze blame | head -20

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not assume the top line delayed the whole boot; follow up with systemd-analyze critical-chain.

Expected output

Startup durations sorted from slowest to fastest.

System impact

Read-only. Nothing changes. systemd prints units ordered by startup duration.

Recovery / rollback: no state is changed.

When to use it

Use after slow reboots, maintenance windows, or image changes that affect startup time.

When not to use it

Do not assume the top line delayed the whole boot; follow up with systemd-analyze critical-chain.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ systemd-analyze blame | head -20

12.441s cloud-init.service
4.982s docker.service
2.104s nginx.service
1.660s networking.service

$ last -x reboot | head -5

reboot   system boot  6.8.0-60-generic Thu Jun 25 14:09   still running
reboot   system boot  6.8.0-60-generic Wed Jun 24 03:12 - 14:08  (1+10:56)
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. systemd-analyze blame | head -20
  2. last -x reboot | head -5

next steps

Related commands

Linux Survival Basics Sensitive output

Show Recent Server Reboots

Confirm whether the server actually rebooted and when.

last -x reboot | head -5
Linux Survival Basics Can be slow

Find the Processes Using Memory

The server felt slow. Memory pressure was the first thing to rule out.

ps -eo pid,comm,%mem,%cpu --sort=-%mem | head
Linux Survival Basics Read-only

Find the Largest Installed Packages

Disk cleanup starts with evidence, not random package removal.

dpkg-query -W -f='${Installed-Size}\t${Package}\n' | sort -nr | head -20
Linux Survival Basics Can be slow

Find the Files Eating Your Disk

The disk was full, but guessing at folders was the slow part.

find /var -type f -printf '%s %p\n' | sort -nr | head -20
Linux Survival Basics Can be slow

Find the Largest CI Logs

Huge logs often point to loops, noisy tests, or runaway debug output.

find logs/ -type f -printf '%s %p\n' | sort -nr | head -10
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:101-system-architecture
  • lpic1:103-gnu-unix-commands
  • lpic1:108-essential-services
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • linuxplus:services-users
  • linuxplus:troubleshooting
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.