Calculating the total disk space consumed by large directory trees is a daily routine for Linux system administrators and developers. The traditional POSIX standard command, du -sh, performs this task sequentially using a single CPU thread. When scanning extensive directory structures—such as huge node_modules folders, dense Git repositories, container storage overlays, or high-capacity NVMe drives—this single-threaded crawl can take substantial time.
diskus is a modern, minimalist command-line utility written in Rust designed as a high-speed replacement for du -sh. By leveraging parallel directory traversal through multi-threading work-stealing algorithms, diskus computes total folder sizes significantly faster than traditional core utilities on modern hardware. While tools like dust allow you to visualise disk usage trees, diskus focuses purely on calculating the total size of given directories at maximum speed.
Why diskus Is Faster Than du
The standard du (disk usage) command inspects files one after another in a linear traversal loop. Even if you possess an 8-core or 16-core CPU and a high-throughput PCIe SSD, du only queries directory metadata on a single core.
In contrast, diskus utilizes parallel directory exploration. It distributes directory reading tasks across multiple worker threads simultaneously. On cold disk caches or large file hierarchies containing hundreds of thousands of small files, benchmarks show diskus can be up to ten times faster than standard du.
Installing diskus on Linux
You can install diskus across major Linux distributions through package managers or via the Rust ecosystem.
Installing on Ubuntu, Debian, and Linux Mint
On Debian-based systems, official .deb binary packages are available directly from the project repository or GitHub releases:
- Download the latest release package using
wget:wget https://github.com/sharkdp/diskus/releases/download/v0.7.0/diskus_0.7.0_amd64.deb - Install the package using
dpkgorapt:sudo dpkg -i diskus_0.7.0_amd64.deb - Resolve any missing dependencies if prompted:
sudo apt-get install -f
Installing on Arch Linux and Manjaro
Arch Linux users can install diskus directly from the official Community repository:
sudo pacman -S diskus
Installing via Cargo
If you have Rust and Cargo installed on your system, build and install diskus with a single command:
cargo install diskus
Verify that your Cargo binary path (typically ~/.cargo/bin) is included in your system PATH variable.
How to Use diskus in the Terminal
Using diskus is exceptionally simple and adheres to modern command-line ergonomics.
1. Calculating Current Directory Size
To inspect the total size of your current working directory, run the command without any arguments:
diskus
The utility outputs the formatted size along with the exact byte count. For example:
14.28 GB (15,334,120,448 B)
2. Checking Specific Paths
To check an arbitrary folder or file path, pass it as a positional argument:
diskus /var/log/
diskus /home/user/workspace/project/
3. Measuring Multiple Directories at Once
You can provide multiple directory arguments simultaneously. diskus aggregates their overall disk footprint into a unified calculation:
diskus /var/log /var/cache /tmp
4. Controlling Worker Threads
By default, diskus automatically detects your system’s available CPU cores and spawns an optimal number of worker threads (typically 3 to 4 times the number of logical cores to saturate I/O pipelines). If you need to restrict thread consumption on busy production servers, use the -j or --threads flag:
diskus -j 4 /var/lib/docker
5. Apparent Size vs. Disk Usage
By default, diskus reports actual physical disk usage (accounting for filesystem allocation blocks and sparse files). If you wish to calculate apparent file size (the sum of actual byte lengths regardless of block allocation), pass the -b or --apparent-size flag:
diskus -b /var/lib/docker
diskus vs du Command Comparison
| Feature | GNU du | diskus |
|---|---|---|
| Execution Model | Single-threaded sequential crawl | Multi-threaded parallel work-stealing |
| Default Output | Requires -sh for human-readable output |
Human-readable and byte count by default |
| Per-Folder Breakdown | Supported (e.g., --max-depth=1) |
Focused strictly on total directory size |
| Large Tree Speed | Moderate to slow on cold SSD caches | Up to 5x–10x faster |
Frequently Asked Questions
Does diskus follow symbolic links?
No. By default, diskus does not follow symbolic links to avoid circular filesystem loops and duplicate counting, ensuring consistent and safe traversal.
Can I create an alias to replace du -sh with diskus?
Yes. Add the following line to your ~/.bashrc or ~/.zshrc file:
alias dush="diskus"
Then reload your shell using source ~/.bashrc.
Does diskus support sorting or tree visualisations?
No. diskus is intentionally designed around UNIX philosophy: doing one specific task (computing total directory size) as fast as physically possible. For interactive tree navigation or visual charts, complementary utilities like ncdu or dust should be employed.