Web Server Rescue
Read-only, can be slowFind Large Directories with du
You know a filesystem is full and need to identify which top-level directory is consuming the most space without crossing into other mounts.
Command
du -xh --max-depth=1 /var 2>/dev/null | sort -h
Before you run this
System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.
When not to use it: Do not start at `/` on a busy production system unless you have a reason. Keep the path narrow and stay on one filesystem.
Expected output
A size-sorted list of directories under `/var`, with the largest entries at the bottom because `sort -h` orders smallest to largest.
System impact
Read-only, can be slow. Nothing changes, but the scan can create disk I/O. The command measures directory sizes and sorts them.
May require elevated permissions on protected paths or service-owned files.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use after `df -h` identifies the full mount and you need a folder-level map before inspecting individual files.
When not to use it
Do not start at `/` on a busy production system unless you have a reason. Keep the path narrow and stay on one filesystem.
next steps
Related commands
Keep du on One Filesystem
A cleanup scan should not wander into mounted backups or network storage.
du -xh --max-depth=1 /var 2>/dev/null | sort -h
Inspect Release Disk Usage
Disk pressure during deploys often starts in old release directories.
du -sh releases/* 2>/dev/null | sort -h | tail -10
Find Which Folder Is Filling the Disk
The disk was full. The fastest clue was the folder, not the file.
du -sh /var/* 2>/dev/null | sort -h
Find the Noisiest Incident Log Files
The biggest log is not always right, but it is worth knowing.
wc -l /var/log/app/*.log 2>/dev/null | sort -nr
Find Which Folder Is Eating Disk Space
When your Mac is full, start with the biggest folders in the current directory.
du -sh ./* 2>/dev/null | sort -h
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.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.