problem area

Linux Survival Basics

The commands to inspect a machine before guessing.

27 checked fixes

One-liners in this area

Linux Survival Basics safe

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 safe

Find Errors Before Reading Every Log Line

The error was in the log. The problem was finding it without reading noise.

grep -iE 'error|failed|denied|timeout' /var/log/nginx/error.log | tail -40
Linux Survival Basics safe

Find the Exact Log Line Before You Scroll

The error was there. The useful part was knowing exactly where it was.

grep -inE 'error|failed|denied|timeout' /var/log/nginx/error.log
Linux Survival Basics safe

Show Only Recent Errors

The log had old failures too. I only cared about the newest ones.

grep -iE 'error|failed|denied|timeout' /var/log/nginx/error.log | tail -10
Linux Survival Basics safe

Check Owner and Mode in One Line

The file existed. The owner and mode explained why it still failed.

stat -c '%A %U:%G %n' /var/www/example/index.html
Linux Survival Basics safe

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 safe

Show Big Files in Human Units

Byte counts are precise. Human units are faster under pressure.

find /var -type f -printf '%s %p\n' | sort -nr | head -10 | awk '{printf "%.1f MB %s\n", $1/1024/1024, $2}'
Linux Survival Basics safe

Count Source Files by Extension

A quick extension count can show whether expected content made it into the source tree.

find source -type f -printf '%f\n' | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr
Linux Survival Basics safe

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
Linux Survival Basics safe

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 safe

List URLs from a Sitemap

Before comparing sitemap coverage, print the URLs plainly.

grep -o '[^<]*' public/sitemap.xml | sed 's###;s###'
Linux Survival Basics safe

Show Failed systemd Units

One command tells you which services systemd already knows are broken.

systemctl --failed --no-pager
Linux Survival Basics safe

Check If a Service Is Active

Get a clean yes-or-no service state without the full status page.

systemctl is-active nginx
Linux Survival Basics safe

Show Recent Server Reboots

Confirm whether the server actually rebooted and when.

last -x reboot | head -5
Linux Survival Basics safe

List Upcoming systemd Timers

Cron is not the only scheduler on modern Linux servers.

systemctl list-timers --all --no-pager