Back to commands

Web Server Rescue

Read-only, can be slow

Find 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

Hosting Operations Can be slow

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
Web Server Rescue Can be slow

Inspect Release Disk Usage

Disk pressure during deploys often starts in old release directories.

du -sh releases/* 2>/dev/null | sort -h | tail -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.

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

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