HappiomHappiom
  • Self-Improvement
  • Relationship
  • AI for Life
  • Apps
  • Tech
  • More
    • Online Diary
    • Glossary
  • Learn
    • Book
    • >> Soft Skills
    • Time Management
    • >> Tech Skills
    • R
    • Linux
    • Python
  • Our Apps
    • Download Diary App
    • Write Your First Diary
    • Login to Online Diary App
    • 100K+ Famous Quotes Site
  • Resources
    • Self-Improvement Guide
      • 21-Days to Self-Improvement
      • Creating a Habit
      • Learn Life Experiences
      • Easily Prioritizing Tasks
      • Learning from Mistakes
      • Doing Regular Exercises
      • Setting Priority for Success
      • Avoiding Common Mistakes
      • Eating Healthy Food Regularly
    • Journaling Guide
      • Online Diary
      • Best Diary Apps
      • Diary Writing Ideas
      • Diary Writing Topics
      • Avoid Writing in Diary
      • Diary Writing as Hobby
      • Reasons to Write a Diary
      • Types of Feelings In Diary
      • Improve Diary Writing Skills
  • Self-Improvement
  • Relationship
  • AI for Life
  • Apps
  • Tech
  • More
    • Online Diary
    • Glossary
  • Learn
    • Book
    • >> Soft Skills
    • Time Management
    • >> Tech Skills
    • R
    • Linux
    • Python
  • Our Apps
    • Download Diary App
    • Write Your First Diary
    • Login to Online Diary App
    • 100K+ Famous Quotes Site
  • Resources
    • Self-Improvement Guide
      • 21-Days to Self-Improvement
      • Creating a Habit
      • Learn Life Experiences
      • Easily Prioritizing Tasks
      • Learning from Mistakes
      • Doing Regular Exercises
      • Setting Priority for Success
      • Avoiding Common Mistakes
      • Eating Healthy Food Regularly
    • Journaling Guide
      • Online Diary
      • Best Diary Apps
      • Diary Writing Ideas
      • Diary Writing Topics
      • Avoid Writing in Diary
      • Diary Writing as Hobby
      • Reasons to Write a Diary
      • Types of Feelings In Diary
      • Improve Diary Writing Skills
Expand All Collapse All
  • Linux Examples
    • 10 Crontab Commands and Examples to Automate Tasks in Linux
    • 10 Linux Commands to Manage Users and Permissions Effectively
    • 10 Practical find Command Examples Every Linux User Should Know
    • 10 Linux Commands to Monitor System Performance - CPU, RAM, Disk, etc.
    • 10 Linux Archive and Compression Commands
    • 10 Disk Usage Commands to Find and Clean Up Space in Linux
    • 10 grep Command Examples to Supercharge Your Searches
    • 10 Networking Commands in Linux for Troubleshooting and Monitoring
    • 10 File Management Commands in Linux for Daily Use
    • 10 Linux Commands to Kill, Pause, and Manage Processes
    • 10 Linux Commands to Search Files Recursively Like a Pro
    • 10 Essential Linux Commands for Searching Files
    • 5 Quick Linux Commands to Find Disk Space
    • Difference between $? vs $@ in Linux Shell Scripting

10 Disk Usage Commands to Find and Clean Up Space in Linux

Running out of disk space is one of the most common issues faced by Linux users, whether you’re managing a local machine or a production server. Fortunately, Linux provides a rich set of command-line tools to help you find out what’s consuming your storage, identify large files or directories, and clean things up safely. These commands can be used individually or in scripts to automate routine storage checks. In this guide, we’ll explore 10 essential disk usage commands that will help you monitor, analyze, and clean up space efficiently. From checking filesystem space to finding unused junk files, this toolkit will keep your Linux system lean and healthy.

1. df — Check Free Disk Space

The df command provides an overview of your disk usage at the filesystem level. It tells you how much space is used and how much is still available across mounted filesystems.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       100G   72G   24G  76% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
  

The -h flag formats output in human-readable units (KB, MB, GB). This is the go-to command for a quick health check of your disk space.

2. du — Check Directory Sizes

While df shows space usage per filesystem, du breaks it down per directory or file. This is perfect for identifying large folders that are consuming space.

$ du -sh /home/myuser/*
1.2G    /home/myuser/Downloads
450M    /home/myuser/Videos
  

Use -s for summary, -h for readable format. This lets you spot space hogs quickly.

3. ncdu — Interactive Disk Usage Viewer

ncdu is a disk usage analyzer with a text-based interface. It recursively scans a directory and lets you interactively browse and delete large files or directories.

$ ncdu /home/myuser
  

Arrow keys navigate; press d to delete items. This is one of the fastest ways to clean up disk space manually.

4. find — Locate Large or Old Files

The find command can locate files based on size, age, and other criteria. It’s extremely useful when you’re looking for old logs, big archives, or junk files.

$ find /home/myuser -type f -size +500M
$ find /var/log -type f -mtime +30
  

Use -size +100M to find files over 100 MB, or -mtime +7 for files older than a week. Combine with -exec rm for cleanup.

5. ls — List and Sort Files by Size

ls combined with sorting options can help quickly identify the largest files in a directory.

$ ls -lhS /home/myuser/Videos | head -10
  

The -S flag sorts by size, largest first. You can use -lt to sort by modification time instead.

6. stat — Get File Size and Access Details

stat displays detailed file metadata, including exact size in bytes, last access time, and more.

$ stat largefile.iso
  

This command is handy when you want precise info on a single suspicious file consuming space.

7. lsof — List Open Files

Sometimes deleted files still occupy space because they’re held open by a process. lsof shows which files are in use, including those marked as deleted.

$ sudo lsof | grep deleted
myapp  13245 myuser  txt    REG  8,1  234567890 /tmp/cachefile (deleted)
  

Restart the process or service to release the space used by such files. This is a common issue on log-heavy servers.

8. du + sort — Sort Directories by Size

You can combine du with sort to generate a ranked list of space usage across directories.

$ du -sh * | sort -rh | head -10
  

This helps quickly identify which folders are consuming the most space in your current directory.

9. journalctl — Manage System Logs

On systems using systemd, logs are stored in binary format and can consume several gigabytes over time. Use journalctl to manage and clean them up.

$ journalctl --disk-usage
Archived and active journals take up 1.2G on disk.

$ sudo journalctl --vacuum-time=7d
  

The second command deletes logs older than 7 days. You can also limit by size using --vacuum-size=500M.

10. du -x / | sort — Limit by Filesystem

When dealing with multiple mount points, use -x with du to restrict output to a single filesystem. This avoids counting mounted drives.

$ sudo du -x / | sort -n -r | head -10
  

Use this when you’re running cleanup scripts on the root filesystem and want to avoid touching mounted network or external drives.

Conclusion

Managing disk space on a Linux system doesn’t require fancy tools—just a strong command-line toolkit and a methodical approach. With these 10 commands, you can monitor usage, find space hogs, and clean up intelligently. From the simplicity of df to the power of find and interactivity of ncdu, you now have everything you need to stay in control of your storage. Many of these tools are script-friendly, making it easy to automate daily or weekly disk health checks.

Pro tip: Add cron jobs to run du, find, or journalctl --vacuum regularly. You can also set up email alerts when disk usage crosses a threshold using df combined with mail or sendmail.

Linux gives you unmatched visibility into how your storage is being used—don’t wait until you’re out of space. Run these commands regularly, stay informed, and enjoy a cleaner, faster, and more reliable system.

Related Articles
  • 10 Crontab Commands and Examples to Automate Tasks in Linux
  • 10 Linux Commands to Manage Users and Permissions Effectively
  • 10 Practical find Command Examples Every Linux User Should Know
  • 10 Linux Commands to Monitor System Performance – CPU, RAM, Disk, etc.
  • 10 Linux Archive and Compression Commands
  • 10 grep Command Examples to Supercharge Your Searches

No luck finding what you need? Contact Us

Previously
10 Linux Archive and Compression Commands
Up Next
10 grep Command Examples to Supercharge Your Searches
  • About Us
  • Contact Us
  • Archive
  • Hindi
  • Tamil
  • Telugu
  • Marathi
  • Gujarati
  • Malayalam
  • Kannada
  • Privacy Policy
  • Copyright 2025 Happiom. All Rights Reserved.