Show Folder Size Linux: The Complete 2026 Guide for Professionals, IT Teams & Cybersecurity Experts

Updated on November 26, 2025, by Xcitium

Show Folder Size Linux: The Complete 2026 Guide for Professionals, IT Teams & Cybersecurity Experts

Managing storage is a critical part of system administration, especially in environments where performance, compliance, and security all depend on clean and optimized file systems. Whether you’re troubleshooting a server running out of space, analyzing logs, monitoring user directories, or performing regular maintenance, knowing how to show folder size in Linux is essential.

Linux gives users incredibly powerful tools to check directory sizes—from the classic du command to interactive tools like ncdu, and even graphical file explorers. In this guide, we cover multiple ways to view folder size in Linux, including commands, flags, utilities, GUI methods, and best practices for storage management. This article is crafted for cybersecurity teams, IT managers, DevOps professionals, and anyone maintaining Linux systems.

Why Knowing Folder Sizes Matters in Linu

Before jumping into commands, let’s look at why this skill is so important in Linux system administration.

1. Prevent Servers from Running Out of Space

A full disk can cause:

  • Application crashes

  • Inability to write logs

  • Failed system updates

  • Security scanning failures

2. Identify Large Directories

This is critical when cleaning up space, especially:

  • Log folders

  • Cache folders

  • Backup directories

  • Database storage

3. Support Cybersecurity & Compliance

Oversized logs or growing suspicious files may point to:

  • Intrusion attempts

  • Malware activity

  • Misconfigurations

  • Unwanted data growth

4. Improve System Performance

File-heavy systems with limited storage can slow down significantly.

5. Support DevOps Pipeline Optimization

Build pipelines and container systems require tight storage control.

How to Show Folder Size in Linux Using the du Command

The most commonly used tool for showing folder size in Linux is the du (Disk Usage) command.

🧰 Basic du Command Syntax

du [options] [file/directory]

1. Show Folder Size in Human-Readable Format

Use the -h flag to display sizes in KB, MB, GB:

du -h foldername

This gives you the size of each subdirectory.

2. Show Total Folder Size Only

If you only want the final size of the folder:

du -sh foldername

Flags explanation:

  • -s = summarize

  • -h = human-readable

3. Show Size of All Folders in Current Directory

du -sh *

This is extremely useful for identifying which directories are large.

4. Show Size of a Specific Directory

Example:

du -sh /var/log

5. Show Folder Size Sorted by Size

Combine du with sort:

du -sh * | sort -h

This gives a list sorted from smallest to largest.

Or reverse:

du -sh * | sort -hr

6. Show Folder Size Including Hidden Files

du -sh .[!.]* *

7. Display Size in Block Format

du -sk foldername
  • -k = show size in KB

  • Replace with -m for MB

Understanding du Output

If you run:

du -h /etc

You might see:

3.4M /etc/ssh
5.8M /etc/logrotate.d
12M /etc

The last line usually shows the total size of the directory.

📦 Using ncdu: A Better, Interactive Way to Show Folder Size

ncdu stands for NCurses Disk Usage, and it is one of the best tools for quickly and interactively analyzing disk usage.

1. Install ncdu

Ubuntu/Debian:

sudo apt install ncdu

CentOS/RHEL:

sudo yum install ncdu

Fedora:

sudo dnf install ncdu

2. Run ncdu

To scan the current directory:

ncdu

To scan a specific folder:

ncdu /var/log

Why ncdu is Popular

  • Interactive interface

  • Easy browsing

  • Delete files safely

  • Sort by size

  • Fast scanning

  • Great for large servers

📁 Using ls to Show File Sizes (Not Folders)

While ls cannot show folder sizes, it can display file sizes.

Show File Sizes in Human-Readable Format

ls -lh

Show File Sizes Sorted by Size

ls -lhS

This helps when diagnosing problems inside a folder.

📊 Using du with Wildcards and Filters

Show All Folders Larger Than 1GB

du -h --threshold=1G *

Excluding Certain Folders

du -sh --exclude=cache *

Show Only Folders (Exclude Files)

du -sh -- */

💻 Show Folder Size in Linux with Graphical Tools

If you’re using a Linux desktop environment like GNOME or KDE, you can view folder sizes visually.

1. GNOME Disk Usage Analyzer (baobab)

Install:

sudo apt install baobab

Then launch:

  • Activities → Disk Usage Analyzer

  • Or run baobab

Features:

  • Sunburst graphs

  • Treemap views

  • Visual folder size mapping

  • Easy troubleshooting

2. KDE Filelight

Install:

sudo apt install filelight

Features:

  • Beautiful radial charts

  • Great for large directories

  • Interactive navigation

🧹 Best Practices for Managing Folder Sizes in Linux

Keeping Linux storage under control is a long-term challenge. Here are practical tips:

1. Monitor /var/log Regularly

Run:

du -sh /var/log/*

Large logs may indicate errors or attacks.

2. Clean up apt cache

sudo apt clean

3. Remove old kernels (Debian/Ubuntu)

sudo apt autoremove

4. Delete old Docker data

docker system prune -af

5. Analyze large user directories

du -sh /home/*

6. Check mail folders on servers

du -sh /var/mail

7. Automate scanning with cron

Example script:

du -sh /var/log > /root/diskreport.txt

Schedule via crontab.

🛠️ Troubleshooting Folder Size Issues

Issue: du Takes Too Long

Fix:

du -sh --apparent-size *

Issue: Hidden folders not counted

Fix:

du -sh .[!.]* *

Issue: Disk full even after deleting files

Cause: Deleted files still held by running processes.

Check:

lsof | grep deleted

Restart services if needed.

❓ FAQ — Show Folder Size Linux

1. What is the best command to show folder size in Linux?

du -sh foldername is the fastest and most reliable method.

2. How do I see a list of all folder sizes?

Use:

du -sh *

3. How can I show folder size with a GUI?

Use tools like Baobab or Filelight.

4. What is the difference between du and df?

  • du = folder and file sizes

  • df = filesystem-level disk space

5. Why is my folder size different from file size total?

Linux uses block allocation, causing slight variations.

Final Thoughts: Linux Makes Disk Analysis Simple — If You Know the Right Tools

Knowing how to show folder size in Linux is a foundational skill for system administrators, DevOps engineers, IT teams, cybersecurity professionals, and developers. With du, ncdu, and GUI tools, you can easily manage disk usage, detect anomalies, optimize performance, and secure your Linux systems.

🚀 Strengthen Your Endpoint & Server Security

Combine strong Linux administration with best-in-class Zero-Trust protection.
👉 Request a Free Demo: https://www.xcitium.com/request-demo/

See our Unified Zero Trust (UZT) Platform in Action
Request a Demo

Protect Against Zero-Day Threats
from Endpoints to Cloud Workloads

Product of the Year 2025
Newsletter Signup

Please give us a star rating based on your experience.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Expand Your Knowledge