How to Check Disk Space in Linux - Coding Campus
Misc

How to Check Disk Space in Linux - Coding Campus

1920 × 1080 px September 15, 2026 Ashley Misc

Ever had that sinking feeling when your Linux system starts acting sluggish, only to realize you're running out of disk space? I've been there, frantically trying to figure out where all the gigabytes went. That's why knowing how to check disk space in Linux is a fundamental skill for any user, whether you're a sysadmin managing servers or just someone who wants their laptop to run smoothly. In this post, I'll walk you through the essential commands and tools I've relied on over the years to monitor and manage disk usage effectively.

Why Checking Disk Space Matters

Before diving into the “how,” let’s talk about the “why.” Disk space isn’t just about storage; it’s about system performance. When your disk fills up, it can lead to slowdowns, failed updates, or even system crashes. In my experience, proactive monitoring has saved me from more than one late-night troubleshooting session. Plus, understanding your disk usage helps you identify what’s consuming space—whether it’s logs, temporary files, or that forgotten ISO download.

Basic Commands for Checking Disk Space in Linux

Linux provides several built-in commands to check disk space. These are the ones I use most frequently:

1. df Command

The df command (short for “disk filesystem”) is my go-to for a quick overview of disk usage. It shows the amount of space used and available on all mounted filesystems.

💡 Note: Use df -h to display sizes in human-readable format (e.g., GB, MB) instead of blocks.

2. du Command

While df gives you a high-level view, du (disk usage) lets you drill down into specific directories. I often use du -sh /path/to/directory to check the size of a particular folder.

⚠️ Note: Be cautious with du on large directories—it can take a while to scan everything.

3. lsblk Command

If you’re more interested in the structure of your storage devices, lsblk lists all block devices (like hard drives and partitions) along with their sizes. It’s not as detailed as df or du, but it’s great for getting a quick layout of your system.

Advanced Tools for Disk Space Analysis

Sometimes, basic commands aren’t enough. Here are a couple of tools I’ve found invaluable for deeper analysis:

1. ncdu (NCurses Disk Usage)

ncdu is a terminal-based disk usage analyzer that provides an interactive interface. It’s like du on steroids. I love using it because it’s fast and lets me navigate through directories to pinpoint space hogs.

2. baobab (Disk Usage Analyzer)

If you prefer a graphical interface, baobab is a great option. It’s part of the GNOME desktop environment and provides a visual representation of disk usage. I’ve used it to quickly identify large files or directories that need cleaning.

Common Scenarios and Solutions

Here are a few scenarios I’ve encountered and how I’ve tackled them using these tools:

Scenario 1: Finding Large Files

If you suspect a few large files are eating up your space, combine find with du to locate them:

find /path/to/directory -type f -exec du -sh {} + | sort -rh | head -n 10

This command finds the 10 largest files in the specified directory—a trick I’ve used countless times to free up space quickly.

Scenario 2: Monitoring Log Files

Log files can grow uncontrollably if not managed. I regularly check the size of log directories using du and set up log rotation with tools like logrotate to prevent them from consuming too much space.

Comparing Disk Space Tools

To help you choose the right tool for your needs, here’s a quick comparison:

Tool Best For Pros Cons
df Quick overview of filesystem usage Fast, built-in Limited detail
du Analyzing directory or file sizes Detailed, flexible Can be slow on large directories
ncdu Interactive disk usage analysis Fast, user-friendly Terminal-only
baobab Graphical disk usage visualization Easy to use, visual Requires GNOME environment

Practical Tips for Managing Disk Space

Here are a few tips I’ve picked up over the years to keep disk space under control:

  • Regularly clean up temporary files: Use tools like tmpwatch to automatically remove old temp files.
  • Monitor large directories: Keep an eye on directories like /var/log and /tmp that tend to grow over time.
  • Use cloud storage for archives: If you have files you don’t need locally, consider moving them to cloud storage to free up space.

Checking disk space in Linux doesn’t have to be a chore. With the right tools and a bit of know-how, you can keep your system running smoothly and avoid those dreaded “disk full” errors. Whether you’re using basic commands like df and du or advanced tools like ncdu, the key is to monitor regularly and act proactively. Trust me, your future self will thank you.

Related Terms:

  • disk space on this computer
  • show my disk space
  • how to find disk space
  • disk space explorer
  • free disk space windows xp
  • yahoo disk space

More Images