How to Check Disk Space in Linux
Last Updated : 28 Apr, 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 Linux
Knowing 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 Linux
Checking 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 Linux
The `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
Syntax of `df` Command in Linux
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 -h

df -h
- Filesystem: Name of the file system or disk partition.
- Size: Total size of the file system or partition.
- Used: Amount of space already consumed.
- Avail: Available or free space on the file system.
- Use%: Percentage of used space relative to the total size.
- Mounted on: Directory where the file system is mounted in the system.
Check the disk space for Specific Drive
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/nvme0n1
2. 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 Size
If 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”).
3. pydf Command to Check Disk Space in Linux
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 Linux
The `fdisk -l` command shows disk size and partitioning information, helping you understand your storage configuration.
sudo fdisk -l

fdisk -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:

lsblk
The 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:
Conclusion
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.
Similar Reads
How to Check Swap Space in Linux
Swap space is like an extra space in your computer's memory. When your computer's main memory (RAM) gets full it uses this extra room (swap space) to store things that aren't being used right now. This extra room is located on your computer's hard drive. Keeping an eye on how much of this extra room
5 min read
How to Open a File in Linuxâ
In Linux, a file is a fundamental unit of storage, representing everything from documents and images to system logs and program data. Unlike traditional operating systems, Linux treats almost everythingâfiles, directories, devices, and processesâas a file. Whether you're accessing a simple text docu
6 min read
How to Check the Size of a Directory in Linux
Many times during working on Linux we may encounter situations, where we want to check the total size occupied by a directory, especially when working with large files and directories. Knowing the file or directory size can help a user perform tasks like storage allocation, size comparison, etc. At
7 min read
How to Manage Directories in Linux?
Directories in Linux or any operating system help to organize the data and files, which is then easier to find and manage. In this article, you will learn everything you will need to manage directories in Linux. We will try to cover every topic from creating, and copying to deleting the directories
6 min read
How to Delete Files in Linux?
Linux comes with several tools that can assist us in removing Directories and files. We always need to delete many files and folders based on a set of requirements. To complete our mission quickly, knowing a few basic commands and their variations is beneficial. Use caution when using the commands b
6 min read
Shell Script to Check Disk Space Usage
Disk usage is a report generated by the Linux system about different disks available or created on the secondary memory. These disks are also known as partitions, they have their isolated filesystem. This facility provides us the measurements of different labels or features like Used space, Free spa
3 min read
How to Set up and Manage Disk Space with LVM in Linux?
Managing disc space in the Linux operating system is essential to keeping a server up to date, especially when storage requirements alter and grow over time by following some major tasks. Logical Volume Manager is a potent tool within the distributed system that Linux offers for managing and configu
5 min read
How to Manage Logs in Linux?
Linux log files are records of system activities, It contains information about processes, errors, and events. Managing these files is crucial for troubleshooting issues, analyzing system performance, and ensuring system stability by identifying security threats. This article will review the command
4 min read
How to Back Up and Restore Data in Linux?
Backing up and restoring data in Linux is essential for ensuring the security and integrity of your files and system. Whether you're safeguarding personal data or managing critical system files, having a reliable backup strategy is crucial. Linux offers various methods and tools for creating backups
4 min read
How to Recover a Deleted File in Linux?
We all have often faced a problem where we have accidentally deleted some files in Linux, that we regretted deleting later on after we did not even find it in the trash. But what if we can recover them? Here, we will discuss How we can recover a Deleted File in Linux. Whenever we delete something fr
4 min read