Last Updated : 12 Jul, 2025
Efficient disk space management is important for maintaining the performance and stability of your Linux system. Over time, files and applications can fill up your storage, potentially causing slowdowns or errors.
Commands to Check DIsk Space in LinuxKnowing how to check disk space in Linux helps you monitor usage, prevent issues, and optimize resources. In this guide, we’ll explore five easy methods to check disk space, ensuring your system runs smoothly.
Methods to Check Disk Space in LinuxChecking disk space in Linux is essential so that we can prevent storage from filling up and ensure smooth system performance. By regularly checking the disk usage, you can identify potential issues and manage storage effectively. Here are all five commands which was used to check disk space in Linux
1. df Command to Check Disk Space in LinuxThe `df`
command, short for “disk-free,” is a tool for displaying available and used disk space on your Linux system. It’s very simple in both usage and reporting
df [OPTIONS]
Here are some common options you can use with the df
command:
Option
Description
-h
Human-readable output (e.g., KB, MB, GB).
--help
Display help information.
-T
Display the file system type.
-a
Display information about all file systems, including those with 0 blocks.
-i
Display inode information instead of block usage.
-k
Display block counts in 1K-byte blocks.
-m
Display block counts in megabytes.
-B <size>
Specify the block size to use.
--total
Display a total summary line.
--version
Display version information.
--sync
Invoke sync before getting usage info.
This option presents disk space information in a human-readable format. It displays sizes in gigabytes (GB), megabytes (MB), or kilobytes (KB) for easy comprehension. Here's an example:
df -hdf -h
If you want to check the disk space from Specific Drive use the below command which show the drive at /dev/sda1
.
df -H /dev/nvme0n12. du Command to Check Disk Space in Linux
While df
checks drives, du
checks folders and files. The `du`
command is used to analyze the disk usage of files, folders, and directories on your Linux system.
Syntax:
du <options> <location of directory or file>
The -h option shows disk usage in a human-readable format for all directories and subdirectories. Here's an example:
du -h /home/administrator/Documents/
Here you can replace "/home/administrator/Documents/" with your desider directory.
Check a Folder’s Total SizeIf you want to check the folder size in linux so use the below command:
du -sh /home/yourname/Documents
-s
: Summarizes the total (no endless file lists).-h
: Human-readable sizes (e.g., "2.5G").pydf is a Linux command written in Python that display the disk usage space in a colorful and readable format. It is an easy-to-use replacement for the df command since it makes disk management more convenient with the use of colors. Utilize the following command below to monitor your disk space effectively:
pydf
Example:
pydf 4. fdisk -l Command to Check Disk Space in LinuxThe `fdisk -l` command shows disk size and partitioning information, helping you understand your storage configuration.
sudo fdisk -lfdisk -l 5. lsblk Command to Check Disk Space in Linux
The lsblk
command in Linux lists information about block devices (like hard drives, SSDs, and their partitions) in a tree-like structure.
lsblk
Example:
lsblkThe lsblk
command showing the details like device names, major/minor numbers, sizes, types, read-only attributes, and mount points. While it doesn’t show precise disk usage, it excels in visualizing the relationship between devices and their partitions.
To calculate unallocated space, add up the sizes of all partitions and subtract this sum from the total size of the drive. This gives a clear idea of unused space on the device.
Also Check:Regularly check disk space in Linux is crucial for maintaining your system's performance and avoiding unexpected storage issues. With the methods outlined in this article, including commands like df
, du
, pydf
, fdisk -l
, and lsblk
, you can effectively monitor and manage your disk usage. Each tool offers unique insights, from a high-level overview to detailed partition layouts.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4