Identifying Available Disk Space

Every file you save takes up additional disk space, and while using the ls -lh command will tell you how much space the files in a directory consume, it doesn’t give you a holistic view of the filesystem. The df and du commands will give you more insight into where your space is going. These commands represent disk space and usage in slightly different ways.

The df command will show you the filesystems, size, used space, available space, and where it’s mounted on the filesystem. By default, it shows everything in bytes. If you use the -h flag, you’ll see all of the sizes represented clearly, similarly to how the -h flag worked for the ls command. Execute the df -h command to see the results on your system:

Get Small, Sharp Software Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.