Linux du Command

How to use du to get the size of each first-level subdirectory in the current folder

On Linux or macOS, use du to get the size of each first-level subdirectory in the current folder:

1
du -h --max-depth=1
  • -h: human-readable units (KB, MB, GB)
  • --max-depth=1: only list first-level subdirectories

To view only the total size of the current directory:

1
du -sh .
  • -s: show only the total summary

These commands help you quickly understand sizes of subfolders in the current directory.

Built with Hugo
Theme Stack designed by Jimmy