Establish your website with a credible and unique web address. Domains serve as an online address for your business to be found online. Let your business and passion reach its full potential by registering the best domain name with us.
Power your website with reliable and secured Web Hosting that comes with 24/7 SuperSupport.
Experience lightning-fast website and application hosting with unbeatable performance. Select the perfect server to take your digital journey to the next level.
Reach local and global customers with a robust website.
Drive customers to your site with our full suite of online marketing solutions.
Protect your online assets from day-to-day security challenges with our feature-packed web security solutions.
Gain customers’ trust with a professional email address powered by the latest email server technology for fast delivery and spam-free inboxes.
Equip your business with all the essential tools you need to get online and save big by purchasing any of our all-in-one customisable packages today.
When you run out of disk space on your Linux system, everything stops working. Suddenly, you can’t save new files, applications might crash, and your system’s performance can degrade. That’s why regularly monitoring your disk space usage isn’t just good practice; it’s essential for keeping your Linux machine running smoothly and efficiently.
This guide is your go-to resource for checking disk space in Linux. We’ll explore a range of powerful commands, from quick overviews to in-depth analyses, giving you the knowledge to confidently monitor and manage your Linux storage and keep your system running smoothly. Let’s get started and ensure you never get caught off guard by an entire disk again!
Before we get into the commands, let’s quickly define “disk space” in a Linux system. Essentially, it’s the amount of space on your storage devices—your hard drives or SSDs—to store your operating system, applications, files, etc.
Disk space is typically broken down into a few key categories:
The df command (short for “disk free”) provides information about file system disk space usage, showing how much space is used and available on each mounted file system.
Basic Syntax:
Simply typing df in your terminal will give you a table of information.
However, the output in its raw form can be a bit cryptic, showing sizes in kilobytes. To make it more human-friendly, we use the following options:
Example Command with Options:
Example Output:
Understanding the Columns:
While df gives you the big picture of file system usage, the du command (short for “disk usage”) is a Linux disk usage analyzer that dives deeper. It allows you to analyze disk space usage at the directory level, which is invaluable for pinpointing where space is consumed within your file system.
Running du without options shows disk usage for the current directory and all sub-directories, which can be overwhelming. Useful options:
Example Command to Check Current Directory Usage:
(The . (dot) represents the current directory.)
This output tells you that the current directory (and everything within it) uses 669 megabytes of disk space.
Example Command to Check Usage of a Specific Directory (e.g., /var/log):
This shows that the /var/log directory uses 421 megabytes of disk space.
The lsblk command lists block devices like hard drives, partitions, and logical volumes in a tree format. Unlike df or du, it doesn’t check space on the Linux server but helps visualize storage layout and capacity
Understanding the Output:
The stat command provides detailed file or system status, including size and disk blocks used. While not meant for disk usage monitoring, it helps inspect individual files.
Example Command to Check Information about a File (e.g., my_document.txt):
Example Output (snippet):
Understanding Relevant Output:
ncdu (NCurses Disk Usage) is a fantastic tool for visually and intuitively exploring disk usage. It provides a navigable interface within your terminal, allowing you to browse directories and see their disk space usage in real time.
On most Debian/Ubuntu-based systems:
On Fedora/CentOS/RHEL-based systems:
To start ncdu in your current directory:
To start ncdu for a specific directory (e.g., /home):
Once ncdu starts, it will scan the directory to check space on the Linux server and display a list of directories and files, sorted by size in descending order.
For even more powerful Linux disk space analysis, you can combine these commands and use shell features like pipes (|) to filter and refine your results.
Example: Finding the Top 10 Largest Directories in /var:
For Linux VPS servers and VPS hosting, disk space monitoring is crucial to prevent downtime, app failures, and crashes.
Let’s recap: Monitoring disk usage in Linux is essential for maintaining system performance, preventing crashes, and ensuring smooth server operations. Whether you’re managing a personal system or a VPS, regularly checking disk space helps avoid service interruptions and potential data loss.
Ready to implement this knowledge and ensure your systems are always running smoothly? Explore Voiden VPS today and take complete control of your server environment!
df (disk free) shows file systems’ overall disk space usage, while du (disk usage) displays space used by specific files and directories.
Use ssh user@remote_server “df -h” to check overall disk space or ssh user@remote_server “du -sh /path/to/directory” for specific directories.
Run du -ah /path | sort -rh | head -10 to list the 10 most extensive files and directories in the specified path.
Yes, use a cron job with df -h or du -sh and send alerts via email or logs. Example: crontab -e and add 0 * * * * df -h | mail -s “Disk Usage Report” [email protected].
Your email address will not be published. Required fields are marked *