Webinar: Role Based AI in One Click: Train, Deploy, and Use Across any Channel | December 17 at 11 AM EST.

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 (8 votes, average: 2.13 out of 5)
Expand Your Knowledge

By clicking “Accept All" button, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookie Disclosure

Manage Consent Preferences

When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.

These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.