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

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.