Finding Your Disk Usage


  

The "du" (disk usage) command displays the number of kilobytes consumed by each file and directories recursively. By default, file sizes are written in 512-byte units, rounded up to the next 512-byte unit.

$ du -s *
(display disk usage of your files and directory at current directory)

$ du -s ~/*
(display disk usage in your home directory and below)

This can be also useful for finding out who the big "disk hogs" are when you're suddenly running low in disk space without even using any. Typing "du -s *" from the parent directory of your home directory, e.g., "/home", or directly typing "du -s /home/*" gives a grand total of the kilobytes consumed by each user under "/home" directory.

The "df" (disk free) command displays the amount of disk space occupied by mounted or unmounted file systems, directories, or the amount of used and available space, and how much of the file system's total capacity has been used in the fileserver.

If directory name (e.g., /home/wclinton) is specified, "df" reports on the file system that contains directory. If not, "df" reports on all mounted file systems.

$ df -k .
(display free disk space and usage of all mounted file systems in kilobytes)

This is often quite handy when determining whether there is enough space to store a big file on a particular hard drive in the fileserver. For further flags and details, please see "man df."