On Debian (or any Linux system), the diff -r command itself does not provide a built-in progress indicator. However, you can monitor its progress using a few workarounds:
pv (Pipe Viewer)pv is a command-line tool that monitors the progress of data through a pipe. You can use it to estimate the progress of diff -r by piping the output through pv.
pv (if not already installed):bashsudo apt update && sudo apt install pv
diff -r Progress:bashdiff -r dir1 dir2 | pv -l -s $(du -s dir1 dir2 | awk '{sum+=$1} END {print sum}')
-l: Counts lines.-s: Estimates the total size (in lines) of the directories being compared.Note: This method estimates progress based on the total size of the directories, but it may not be perfectly accurate.
progress (Linux Utility)The progress tool can monitor the progress of coreutils commands (including diff) by tracking file operations.
progress:bashsudo apt update && sudo apt install progress
diff -r in One Terminal:bashdiff -r dir1 dir2 > output.diff
bashprogress -w
-w: Watches for file operations.Note: This works best if diff is writing to a file, as progress tracks file I/O.
strace (Advanced)If you want to see system calls (including file reads), you can use strace to monitor diff -r activity.
diff -r with strace:bashstrace -f -e trace=file diff -r dir1 dir2
-f: Follows child processes.-e trace=file: Filters for file-related system calls.Note: This is verbose and not a traditional progress bar, but it shows real-time file activity.
rsync for Progress (Alternative Approach)If your goal is to compare directories and see progress, consider using rsync with the --dry-run and --progress flags:
bashrsync -avn --progress dir1/ dir2/
-a: Archive mode.-v: Verbose.-n: Dry run (no changes).--progress: Shows progress for each file.Note: This doesn't use diff, but it achieves a similar goal with progress feedback.
pv.progress.strace.rsync --dry-run.Vibe can make mistakes. Check answers. Learn more