Check disk space

To check how much disk space your files are using, you can use the df command. Invoked without any options, this command shows disk space usage on all of a system’s partitions:

linux df command

In the example above you can see the device file associated with the file system, the total amount of space on the file system, the used space on the file system, the free space on the file system, the percentage of space that’s used, and the mount point. Disk space is shown in 1KB blocks. To produce output in a more human-readable form, use the -h option:

linux df command h option

To print file systems of a particular type, you can use the -t option:

linux df command t option

To list available and used inodes, use the -i option:

linux df command i option

To print all file systems, including the ones that have no space, such as /proc and /dev/pts, use the -a option:

linux df command a option

In addition to these options, you can specify one or more files to df . When you do this, df restricts its report to the file system on which the specified file or directory exists. For example, to learn about the disk space usage on the /home partition, we could type df /home:

linux df command home directory

Geek University 2022