> ## Content Index
> Fetch the complete content index at: https://aquasp.blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to check disk usage per file or directory on linux
- URL: https://aquasp.blog/how-to-check-disk-usage-per-file-or-directory-on-linux/
- Published: 2025-12-09T01:34:27.000Z
- Updated: 2025-12-09T01:34:27.000Z
- Description: The perfect cheat sheet for checking disk usage on linux!
- Author: Aquasp
- Tags: Guides

# Introduction

Whether you're debugging a full VPS, cleaning up a home server, or just curious — here are the **fastest and most useful** commands to understand what's eating your disk space.

## 1\. Find the Biggest Files & Folders in the Current Directory

```bash
du -shc * | sort -rh | head -15
```

- du -shc \* → shows size of everything in the current folder (human-readable, with total)
- sort -rh → sorts from biggest to smallest
- head -15 → shows only the top 15 culprits (change number as needed)

Perfect for quickly spotting that one huge log file or backup folder.

Pro tip: Run it in /var, /home, or / to hunt down space hogs.

## 2\. Check Overall Disk Usage (All Partitions)

```
df -h
```

Shows:

- Total/used/available space
- Percentage used
- Mount point

Look for the line with / (root) or your main drive.  
Example: 64G used / 226G total → 28% full

Add --exclude-type=tmpfs to hide temporary filesystems:

```
df -h --exclude-type=tmpfs --exclude-type=devtmpfs
```

## 3\. Check Inode Usage (When "Disk Full" But df Shows Space Left)

Sometimes your disk is full of **millions of tiny files** (logs, cache, sessions, etc.). Each file uses one inode.

Check inodes per folder in current directory:

```
du --inodes --max-depth=1 . | sort -nr
```

Or system-wide:

```
df -i
```

If "IUsed" is near 100%, you’re out of inodes — time to clean up small files!

## Bonus One-Liners

```
# Top 10 biggest directories in /home
du -h /home | sort -rh | head -10

# Find files bigger than 1GB
find / -type f -size +1G 2>/dev/null

# Show only real disks (clean output)
df -h -x squashfs -x tmpfs -x devtmpfs
```

That’s it!

You now have the ultimate toolkit to **never be surprised** by a full disk again.

If you found this helpful, share it with a friend or subscribe to **The Self Hosting Art**.

Thank you for reading!