Back to commands

Linux Survival Basics

Read-only, sensitive output

Show 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.

demo@lab:~$

$ 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

  1. last -x reboot | head -5
  2. uptime

next steps

Related commands

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

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
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 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.

  • lpic1:103-gnu-unix-commands
  • lpic1:104-filesystems-permissions-fhs
  • lpic1:107-admin-tasks
  • lpic1:110-security
  • lfcs:essential-commands
  • lfcs:users-groups
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • linuxplus:security
  • risk:read-only
  • risk:security-sensitive

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.