Merry Christmas & Happy 2027! Less downtime. More good times. Celebrating 13 years of sorlavit.com
Skip to content
Sorlavit KimIT Support, Network & Infrastructure Services Let’s talk

Articles are written in English. The Thai translation button opens Google Translate; code and commands stay in their original form.

Linux Commands / IT Support Guides

Find growing directories with du

Use du to see which subdirectories use the most disk space before deciding where to investigate.

Compiled for Sorlavit Kim · Published · Updated · 1 min read

Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution

Understand the problem

Choose one directory on the affected filesystem. The command reads directory entries and can take time if there are many files.

Run the command

Run the example for /var/log or replace it with the directory you want to inspect. The -x option keeps the scan on that filesystem, -h adds readable units, and --max-depth=1 limits the displayed totals to one level below the starting directory.

du -x -h --max-depth=1 /var/log

Read the output

A line such as 240M /var/log/journal is the total for that subdirectory. The line ending in /var/log is the total for the whole starting directory, so it already includes journal.

Choose the next step

Run the same command with the largest relevant subdirectory as the starting point. If the command reports Permission denied, treat the totals as incomplete.

Before making changes

Before cleanup, check who owns the files and how long they must be kept. A deleted file can still use disk space while a process holds it open, which can help explain a difference between du and df.

Source & further reading

GNU Coreutils — du invocation

Independently written summary reviewed on 2026-11-01. The example illustrates a possible application; it is not a client case study.

Share this article

Back to all articles