Linux Survival Basics
Read-only, sensitive outputShow Recent Server Reboots
After an outage, deploy, or provider event, you need evidence of reboot timing without guessing from logs.
Command
last -x reboot | head -5
Before you run this
System impact: Read-only. Output may expose users, paths, tokens, keys, IPs, process arguments, or log details.
When not to use it: Do not rely on it if wtmp rotation or cleanup removed older records.
Expected output
Recent reboot rows with boot time and current running status.
System impact
Read-only, sensitive output. Nothing changes. last prints recent reboot records from login history.
Recovery / rollback: no state is changed.
When to use it
Use after provider maintenance, unexpected downtime, kernel updates, or suspected crashes.
When not to use it
Do not rely on it if wtmp rotation or cleanup removed older records.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ 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)
$ uptime
14:34:10 up 2 days, 4:18, 1 user, load average: 0.32, 0.58, 0.71
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
last -x reboot | head -5uptime
next steps
Related commands
Find Slow Services During Boot
Find which units made your VPS boot slowly.
systemd-analyze blame | head -20
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
Count Failures by Test File
Turn noisy test logs into a ranked failure list.
grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
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
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
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.
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.