How to Check Disk Usage in Linux Using the ncdu Command

When it comes to identifying what’s taking up valuable disk space on your Linux system, navigating through the complex web of directories and files can be quite challenging. However, the ncdu command offers a convenient and interactive solution to this problem. This guide will show you how to use ncdu to easily assess disk usage and manage space-consuming files on your Linux system. With ncdu, you can quickly pinpoint the culprits that are taking up valuable space and take steps to free up your system’s storage.

Importance of Checking Disk Usage

Monitoring disk usage in Linux is essential for various reasons. Here are four key reasons why checking disk usage is important:

  1. Optimizing System Performance. As a disk becomes full, the system can experience a slowdown. By monitoring and managing disk usage, you can ensure optimal system performance by freeing up space when necessary.
  2. Preventing Data Loss. A system running out of disk space can lead to incomplete file writes or corruption, potentially resulting in data loss. By keeping an eye on disk usage, you can proactively address space concerns before they become critical.
  3. Planning for Upgrades. Regularly monitoring disk usage helps in capacity planning. By understanding your storage trends, you can anticipate when you’ll need to upgrade your storage solutions or archive older data.
  4. Identifying Unwanted Files and Applications. Over time, systems accumulate unnecessary files, backups, logs, or unused applications. Regularly checking disk usage can help you identify and remove these redundant items, ensuring that your system remains clean and efficient.

Regularly monitoring disk usage in Linux is essential for maintaining system health and facilitates proactive planning for optimal performance. Next, we’ll explore how to use the ncdu command.

Process to Check Disk Usage Using ncdu

#1 Installing ncdu

If ncdu isn’t already installed on your Linux system, you can usually install it via the package manager.

For Debian/Ubuntu:

sudo apt install ncdu

For CentOS/RHEL:

sudo yum install ncdu

This command installs the ncdu utility. It’s important to have it installed to proceed with the subsequent steps.

#2 Using ncdu to check disk usage:

Navigate to the directory you want to analyze (e.g., /var) or stay in the home directory. Then run:


Sample Output:

    .  24.0 MiB [##########] /some_folder
    .  16.0 MiB [######    ] /another_folder
    .   4.0 MiB [##        ] /yet_another_folder
    .   1.0 MiB [#         ]  some_file.txt

This command will analyze the directory and provide a visual representation of space usage. The folders and files are sorted by size.

#3 Navigating the ncdu interface:

  • Up/Down Arrows: Navigate through the list.
  • Right Arrow/Enter: Dive into a directory.
  • Left Arrow: Go up one directory level.
  • d key: Delete the selected file or directory.
  • q key: Quit ncdu.

ncdu provides an interactive interface. Knowing these keys helps you efficiently navigate and manage files and directories based on their size.

#4 Running ncdu on a specific directory

This command lets you directly analyze the specified directory without needing to navigate there first.

Congratulations! You can now monitor disk usage in Linux using the ncdu command. This utility is invaluable for gaining insights into and managing disk space in Linux, offering a detailed and interactive perspective. This aids users in making well-informed decisions about file and directory management. Always double-check before deleting any files or directories.

Subscribe and discover the newest
updates, news, and features

We value your inbox and are committed to preventing spam