On Debian (and most Linux systems), the du command itself does not natively show progress while calculating disk usage. However, you can use alternative tools or workarounds to monitor progress. Here are the best options:
1. Use pv (Pipe Viewer)
pv is a command-line tool that monitors the progress of data through a pipe. You can combine it with du to estimate progress.
Install pv:
bash
sudo apt update && sudo apt install pv
Usage:
bash
find /path/to/directory -type f -print0 | pv -l -s $(find /path/to/directory -type f | wc -l) | xargs -0 du -sh
This counts the number of files first, then uses pv to show progress as du processes them.
Limitation: This only shows progress for file counting, not actual disk usage calculation.
2. Use ncdu (NCurses Disk Usage)
ncdu is a more interactive and user-friendly alternative to du. It shows progress as it scans directories.
Install ncdu:
bash
sudo apt update && sudo apt install ncdu
Usage:
bash
ncdu /path/to/directory
ncdu will scan the directory and show a progress bar.
After scanning, you get an interactive interface to explore disk usage.
3. Use gdu (Fast Disk Usage Analyzer)
gdu is a modern, fast alternative to du with a progress bar.
Install gdu:
bash
sudo apt update && sudo apt install gdu
Usage:
bash
gdu /path/to/directory
gdu shows a progress bar as it scans.
4. Use progress (Linux Process Progress Viewer)
The progress tool can monitor the progress of coreutils commands like du.
Install progress:
bash
sudo apt update && sudo apt install progress
Usage:
Run du in one terminal:
bash
du -sh /path/to/directory
In another terminal, run:
bash
progress -w
This will show the progress of du if it supports it (works best with dd, cp, etc., but may not always work with du).
5. Use ionice and nice for Background Monitoring
If you just want to run du in the background and check its progress occasionally, you can use: