> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Find What Is Using Disk Space on Linux with ncdu

> Find what is using disk space on Linux with ncdu -x / to browse folders by size, find to list big files, and lsof +L1 for deleted files that still hold space.

To find what is using disk space on Linux, install `ncdu` and run `sudo ncdu -x /`. It lists folders from largest to smallest; press Enter to open one. To list big files, run `sudo find / -xdev -type f -size +1G -exec ls -lh {} +`. If `df` shows a full disk but you find nothing, run `sudo lsof +L1` to spot deleted files still held open.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 10 minutes | Ubuntu, Debian, AlmaLinux, Rocky Linux, Fedora, Arch | sudo |

## Before you start

* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). Commands use `sudo` so they can read every folder; root users can leave it out.
* First see which disk is full with `df -h`. See [check disk space](https://help.freakhosting.com/portals/other/how-to-check-disk-space-on-linux.md).
* If the disk is already 100% full and services are failing, also read [fix "No space left on device"](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md).

## How to install ncdu

**ncdu** (NCurses Disk Usage) is an interactive version of `du`.

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo apt update && sudo apt install ncdu
> ```

> [tab] AlmaLinux / Rocky
>
> ncdu comes from EPEL:
>
> ```bash theme={null}
> sudo dnf install epel-release
> sudo dnf install ncdu
> ```
>
> If it is not available for your release, use the `du` command further down.

> [tab] Fedora / Arch
>
> ```bash theme={null}
> sudo dnf install ncdu      # Fedora
> sudo pacman -S ncdu        # Arch
> ```

## How to find what is using disk space with ncdu

**1. Scan the disk**

```bash theme={null}
sudo ncdu -x /
```

`-x` stays on one file system, so it skips other disks and `/proc`. Scanning a large disk can take a minute.

**2. Browse by size**

The biggest folders are at the top. Use the arrow keys to move, **Enter** (or right arrow) to open a folder and the left arrow to go back.

**3. Find the cause**

Keep opening the largest folder until you reach the files that use the space, for example `/var/log/journal` or `/var/lib/docker`.

| Key | Action |
| - | - |
| `?` | Help and all keys |
| `d` | Delete the selected file or folder (asks first) |
| `i` | Details about the selected item |
| `s` / `n` | Sort by size / by name |
| `g` | Switch between percentage and graph |
| `r` | Rescan the current folder |
| `q` | Quit |

> [!WARNING]
>
> `d` deletes for good, with no recycle bin. Never delete system folders such as `/usr`, `/lib`, `/boot` or `/var/lib/dpkg`, or database files in `/var/lib/mysql`: that breaks the server. To browse safely with no delete key, use `sudo ncdu -x -r /` (read-only).

## How to find large files without ncdu

List every file over 1 GB on the root file system:

```bash theme={null}
sudo find / -xdev -type f -size +1G -exec ls -lh {} + 2>/dev/null
```

Or see the largest folders, one level at a time:

```bash theme={null}
sudo du -h --max-depth=1 -x / 2>/dev/null | sort -h | tail -n 15
```

## What usually fills a Linux server's disk?

| Where | What | How to clean it up safely |
| - | - | - |
| `/var/log/journal` | systemd journal | `sudo journalctl --vacuum-size=500M` keeps the newest 500 MB. See [read logs with journalctl](https://help.freakhosting.com/portals/other/how-to-read-logs-with-journalctl.md) |
| `/var/log/*.log`, `*.gz` | Old and very large log files | Delete old rotated `.gz` files. Empty a live log with `sudo truncate -s 0 /var/log/example.log` instead of deleting it |
| `/var/cache/apt`, `/var/cache/dnf` | Downloaded packages | `sudo apt clean` (Ubuntu / Debian) or `sudo dnf clean all` (AlmaLinux / Rocky) |
| `/boot`, `/usr/lib/modules` | Old kernels | `sudo apt autoremove --purge` on Ubuntu / Debian |
| `/var/lib/docker` | Images, stopped containers, build cache | See [clean up Docker disk space](https://help.freakhosting.com/portals/other/how-to-clean-up-docker-disk-space.md) |
| `/home`, `/root`, `/backup` | Old backups, archives, downloads | Move off the server or delete what you no longer need |
| `/var/lib/mysql` | Database files and binary logs | Do not delete files here by hand; clean up inside MySQL/MariaDB |

## Why does df show a full disk when du does not?

A file that was deleted while a program still has it open keeps using space until that program closes it. Find such files:

```bash theme={null}
sudo lsof +L1
```

```text theme={null}
COMMAND   PID USER   FD   TYPE DEVICE   SIZE/OFF NLINK    NODE NAME
nginx    1234 www-data 5w  REG  254,1 9663676416     0 1207209 /var/log/nginx/access.log (deleted)
```

Restart that service to free the space, for example `sudo systemctl restart nginx`. See [manage services with systemctl](https://help.freakhosting.com/portals/other/how-to-manage-services-with-systemctl.md).

## Frequently asked questions

### What does "No space left on device" mean when df shows free space?

You may have run out of **inodes** (the slots that track files), usually because of millions of tiny files such as sessions or cache. Check with `df -i`. If `IUse%` is 100%, find the folder with the most files and clean it up.

### Is it safe to delete files in /var/log?

Old rotated logs (`.1`, `.gz`) are safe to delete. For the current log of a running service, use `truncate -s 0` instead of `rm`, so the service keeps writing to the same file.

### How do I make the server stop filling up again?

Limit the journal with `SystemMaxUse=500M` in `/etc/systemd/journald.conf`, make sure logrotate runs, clean Docker regularly and keep backups off the server. Monitoring alerts help too: see [email alerts when your server goes down](https://help.freakhosting.com/portals/other/how-to-get-email-alerts-when-your-server-goes-down.md).

### How do I get more disk space on my VPS?

Upgrade to a plan with a bigger disk, then [resize the partition](https://help.freakhosting.com/portals/other/how-to-resize-a-partition-after-a-disk-upgrade.md). See [VPS storage](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md).

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Check disk space](https://help.freakhosting.com/portals/other/how-to-check-disk-space-on-linux.md)
>
> df and du basics.

> [card] [Fix No space left on device](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md)
>
> When the disk is already full.

> [card] [Clean up Docker disk space](https://help.freakhosting.com/portals/other/how-to-clean-up-docker-disk-space.md)
>
> Remove unused images and volumes.

> [card] [Resize after a disk upgrade](https://help.freakhosting.com/portals/other/how-to-resize-a-partition-after-a-disk-upgrade.md)
>
> Use the space from a bigger plan.

***

> [!NOTE]
>
> **Checked against the official [ncdu manual](https://dev.yorhel.nl/ncdu/man)** on 4 November 2026; `ncdu -x`, `find -size +1G`, `du | sort -h`, `lsof +L1` with a deleted open file, `df -i` and `journalctl --vacuum-size` options tested on Ubuntu 24.04 LTS (ncdu 1.19). Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.