unixaixdiskspace

What is the unix command to see how much disk space there is and how much is remaining?


I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info.


Solution

  • Look for the commands du (disk usage) and df (disk free)

    Specifically:

    df -h shows the total size, usage, and %usage of every partition.

    du -h --max-depth=1 | sort -h shows the size of the current directory and its subdirectories, sorted by size.

    The -h flag on each command is for "human readable" formats, i.e. show "MB" or "GB" instead of the size in bytes.