Linux · System Tools
xdu
xdu is a command‑line disk‑usage analyzer for Linux, similar to Windows TreeSize Free.
- License
- GPL-3.0
- Latest version
- 3.0
What is xdu?
xdu is a lightweight tool that scans directories and reports disk usage in a tree‑like format. It has been part of Debian and Ubuntu repositories for many years, making it a reliable choice for users who prefer simple, scriptable utilities over graphical interfaces.
The target audience is sysadmins, developers, and power users who need quick, accurate disk‑usage reports without the overhead of a GUI. It works from the terminal, so it integrates well with shell scripts and remote management.
Compared to TreeSize Free, xdu offers a comparable view of folder sizes but without visual charts or color coding. It is faster on large file systems and can be combined with other command‑line tools like grep or awk for custom analysis.
Best for: Users who need quick, scriptable disk‑usage reports on servers or in automation pipelines.
Key features of xdu
- Fast, single‑process scanning
- Tree‑structured output
- Human‑readable size units
- Optional depth limit
- Supports symbolic links
- Can be piped to other tools
Pros
- No GUI overhead
- Works on headless servers
- Fully scriptable
- Consistent output across distributions
Cons
- Lacks graphical interface
- No color or charting
- Requires terminal knowledge
Windows programs xdu replaces
How to install xdu on Linux
sudo apt install xdusudo apt install xduTips for Windows users
If you’re used to TreeSize Free’s GUI, start by running xdu /path to see a plain text tree. Use -d N to limit depth, and pipe the output to less or grep for filtering. File formats are plain text, so you can redirect to a file and open it with any editor. Shortcuts are terminal commands; for example, Ctrl+C aborts the scan.
xdu: frequently asked questions
Is xdu available on all Linux distributions?
xdu is in the official repositories of Debian, Ubuntu, and many derivatives. You can install it with apt install xdu.
Can xdu follow symbolic links?
By default it does not follow symlinks to avoid loops, but you can enable it with the -L option. Use with caution on network mounts.
Does xdu support color output?
No, xdu outputs plain text. If you need color, pipe the output through ccze or similar tools.
How does xdu handle very large directories?
It reads directory entries sequentially, so memory usage stays low. The scan time is proportional to the number of files, but it is usually faster than graphical tools.
Updated