Checking available and used disk space

Two useful terminal commands for checking disk usage in Linux, are the commands df and du.

The first command, df, provides a table of file systems with information on free and used disk space. Note: Using the -h option provides the table in a human readable format.

df -h

The second command, du, can also retrieve disk usage information. Typing du into any directory will provide a list of files and directories at the specified location with their corresponding disk usage. However du may be more useful with the options -s and -h providing a human readable summary of the specified location on disk.

eg. display disk usage for the current working directory

du -hs

or at a specified directory

du -hs directoryname


Quick Tip: Disk Usage in Terminal

When investigating your disk usage, there are two simple terminal commands which can make your life easier.

The first command df, provides a usage report for your file system, providing a list of partitions and the amount of space which has been used and how much space is available in each.

eg. df

Another command that can provide more specific information on disk usage is the du command. This command will provide a list of each file and directory and the amount of disk spaced used by each, with the total disk usage for the specified directory/file provided at the end of the output.

eg. du /home

Like most terminal commands, a number of arguments can be used in conjunction. One very useful argument is the -h argument, which provides the output of both commands in a human readable format. An examples of using this argument can is shown below,

df -h
du -h /home