If you experience any difficulty in accessing content on our website, please contact us at 1-866-333-8917 or email us at support@chicagovps.net and we will make every effort to assist you.

By
January 9, 2025

A Comprehensive Guide to Examining Disk Space on Linux

 

To effectively evaluate and manage disk storage on Linux systems, various commands are available that can help diagnose and report on disk usage.

Using the df Command

The df (disk free) command provides a summary of disk space usage, showing the amount of used and available space on mounted filesystems:

$ df

This command displays the disk usage in kilobytes. To present the data in a more human-readable format, use the -h option:

$ df -h

You can also check disk space for a specific directory or filesystem:

$ df /home

Using the -T option alongside df will show the filesystem type in the output:

$ df -T /home

Using the du Command

The du (disk usage) command tracks how much disk space is used by files and directories. To get a summary of the size of the current directory:

$ du -sk

For a more detailed report without showing each file’s size, combine it with the -sh options:

$ du -sh .

To find the largest files or directories, the follow command can be used:

$ du -ah /home/user | sort -rh | head -n 5

Using the ls Command

Additionally, the ls command can help in listing files by size. The following command shows the largest files in a directory:

$ ls -lhS | head -5

Using the fdisk and lsblk Commands

The fdisk command can offer insights into disk partitions, while lsblk provides a tree view of disk devices and their mount points:

$ sudo fdisk -l   # For partition stats
$ lsblk           # To see mounted filesystems

Conclusion

These commands are essential for managing disk space effectively on Linux. They allow administrators to quickly assess disk usage, making it easier to diagnose issues and manage resources efficiently.


ChicagoVPS is your gateway to unparalleled hosting solutions. Our state-of-the-art datacenters and powerful network ensures lightning-fast speeds and uninterrupted connectivity for your websites and applications. Whether you’re a startup looking for scalable resources or an enterprise in need of enterprise-grade hosting, our range of plans and customizable solutions guarantee a perfect fit. Trust in ChicagoVPS to deliver excellence, combining unmatched reliability and top-tier support.

For Inquiries or to receive a personalized quote, please reach out to us through our contact form here or email us at sales@chicagovps.net.

Subscribe Email

Top