Skip to main content

Disk Usage utility

df - File System Disk Usage

The command df reports the total disk usage on the mounted file system. For example, how much space is still available in the root partition, how much space is still left on the /dev/sda1 partition that you have created and where it is mounted at.

By default, the output of df list out long numbers can be difficult to interpret, so you can provide the -h flag to make the output more human readable, in terms of bigger units essentially.

du - Disk Usage

This command tells us the amount of spaces that's occupied in the current directory by each of the folders, and how much spaces is occupied by current folder in total. Use -h for again human readable format.

If there are nested folders, each of the nested folder's information will also be shown, but you only add the size from the most outer folder that contains them!

You can provide a folder path or a path to a file to see how much space they take up.

Use the -s flag to just get a summary of the current folder to see how much space it is taking up.

Folder Size

A note on the folder size not the content that's within the folder. A folder is essentially another file that contains meta data about all the other files that's contained in it. The size of a folder is typically 4KB in Linux system. So if you just run du in a empty folder you should see the total space occupied is 4KB because the current folder takes up 4KB by itself!

lsblk - List Block Devices

Print out information about block devices like file systems that's mounted or not mounted.

Useful for checking what drives are connected.