Find the largest files and folders on Linux

Rank the 20 biggest items under the current directory by disk usage.

LinuxFilesDiagnosticsTerminalLow risk
cd into the directory you want to scan and run the command below. The 20 largest files and folders are listed, largest first.

01Command

Command
$ du -ahx . | sort -rh | head -20

02What it does

du -ahx estimates usage for every file (-a), human-readable (-h), staying on one filesystem (-x) so mounted volumes are skipped. sort -rh sorts human-readable numbers in reverse, and head -20 keeps the top of the list.

03Risk

RiskLow risk
CompatibilityGNU coreutils (Debian/Ubuntu, RHEL 等)

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • du(1) — estimate file space usage
    man7.org · vendor-doc · 2025-11-21
    Evidence: du -a lists all files; -x stays on one filesystem; combined with sort -rh shows largest first.

Last verified: 2025-11-21 · Category: Files & Folders

06Related solutions