Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Shell Scripting
  • Kali Linux
  • Ubuntu
  • Red Hat
  • CentOS
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Python
  • R
  • Java
  • C
  • C++
  • JavaScript
  • DSA
Open In App
Next Article:
How to Delete Files in Linux?
Next article icon

How to Check Disk Space in Linux

Last Updated : 28 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

How-to-Check-Disk-Space-in-Linux

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

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
1

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.

du -h

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:

pydfss

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

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:

Screenshot-from-2025-01-04-11-35-34

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:

  • Shell Script to Check Disk Space Usage
  • How to Check the Size of a Directory in Linux
  • How to Check Swap Space in Linux
  • Discus – Show Colourised Disk Space Usage in Linux

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.



Next Article
How to Delete Files in Linux?
author
itsvinayak
Improve
Article Tags :
  • Linux-Unix
  • Technical Scripter
  • linux
  • Technical Scripter 2019

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
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences