Show Free Disk Space on Linux

Submitted by Peter Majmesku on Tue, 05/23/2017 - 13:17

df

The "disk free" program shows the free space on a storage device via command line.

  • Show free space for the entire filesystem:
    •  df -h
  • Show free space for the local filesystem:
    • df -hl
  • Show more documentation regarding the "df" program:
    • man df

du

The "disk usage" program shows the used, not free, space on a storage device via command line.

  • Show the used space amount on the entire file system:
    • du -sh /
  • Show the used space of the folder named "media" by excluding ".bmp"-files:
    • du --exclude="*.bmp*" -sh media/ 
  • Show the used space of the current directory:
    • du -sh ./
  • Sort the folders in the current directory (recursion depth 1) by their disk usage:
    • du -h --max-depth 1 ./ | sort -h
  • Show more documentation regarding the "du" program:
    • man du
Tags