How to Check Disk Space and Usage in Linux Using df and du
Learn how to efficiently monitor disk storage and analyze file system usage on Linux machines using essential commands like df, du, and find.

Stock photo for illustration only, not from the actual event
- A full disk can degrade system performance and cause service failures
- The df command provides a quick overview of system-wide disk usage
- The du command helps analyze specific file and directory sizes
- Combining commands enables fast tracking of large files on Linux
A full storage disk can severely degrade Linux system performance, trigger service failures, and even block users from logging in or reaching vital directories. Keeping a close eye on disk consumption remains a fundamental task for maintaining any Linux environment. Linux comes equipped with built-in command-line utilities—specifically df, du, and find—that allow administrators to inspect utilized storage, available capacity, and pinpoint precisely which files or directories are consuming valuable disk space.
This guide explores practical examples of each utility, enabling you to check available disk space, analyze mounted file systems, and troubleshoot storage-related bottlenecks efficiently. By the end, you will possess a reliable toolkit of commands to monitor disk consumption and track down oversized files across any Linux distribution.
Linux features several essential command-line tools designed to monitor and manage disk storage effectively. The df utility offers an immediate overview of disk usage across all active mounted file systems, allowing you to identify partitions running low on free space and take action before performance drops. The standard syntax is df [OPTION]... [FILE]..., and omitting a file or directory displays space for all mounted file systems.

Stock photo for illustration only, not from the actual event
Key use cases and examples for the df command include:
- Display human-readable usage: Use
df -hto output capacities in easily digestible formats. - Check a specific mount point: Run
df -h /mntto inspect an individual partition. - Filter by file system type: Use
df -h -t ext4to target specific file systems like ext4. - Exclude specific file systems: Run
df -h -x tmpfsto omit temporary systems from results. - Include file system types: Use
df -hTto display the type column alongside capacity metrics. - Monitor inode usage: Execute
df -ito track total, used, and free inodes for managing file counts.
Understanding the distinction between raw disk space and inode availability is critical. Systems can sometimes report ample free disk space while rejecting new file creation simply because the inode table is exhausted—often caused by massive quantities of tiny files. Running df -i helps catch this overlooked bottleneck early.
Meanwhile, the du (disk usage) utility estimates and displays storage consumed by specific files and directories, assisting administrators in locating bulky folders that require cleaning. Its basic syntax is du [OPTION]... [FILE]..., defaulting to the current working directory if no path is supplied.
Important examples of the du command include:
- Check directory size cleanly: Run
sudo du -sh /path/to/directory, typically requiring elevated privileges due to restricted folder permissions. - Include hidden files: Append the
-aflag to track dotfiles and hidden configurations. - Exclude temporary logs: Use
sudo du -ah --exclude='*.log' /path/to/directoryto ignore irrelevant log files. - Limit directory depth: Run
sudo du -h --max-depth=1 /varto inspect top-level subdirectories. - Sort by largest size: Pipe the output through
| sort -rhto list the biggest directories at the top.
Additionally, you can combine find and du operations to locate massive files—such as assets exceeding 50MB inside /var—revealing exact file sizes, permission structures, and recent modification dates.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment