nicoorfi
2/14/2019 - 1:16 PM

Check size

Check size

  • Check file size and sort: ls -lhS

  • Check the folder size: du -s ./folder

  • Check size and sort: Will sort the folders by size. du -chd 1 | sort -h (Helpful when looking to clear space.)

Check subdirectories

Note that if you want to know all {sub}folders size inside a directory, you can also use the -dor --max-depth option of du (which take an argument: the recursive limit)

du -h /path/to/directory -d 1

Disk usage

Check disk usage du -sh *

Short version of:du --summary --human-readable *

Explanation:

du: Disk Usage

-s: Display a summary for each specified file. (Equivalent to -d 0)

-h: "Human-readable" output. Use unit suffixes: Byte, Kibibyte (KiB), Mebibyte (MiB), Gibibyte (GiB), Tebibyte (TiB) and Pebibyte (PiB). (BASE2)