Created
January 16, 2021 10:56
-
-
Save countingpine/5caa1129562e815ee469d14f64683402 to your computer and use it in GitHub Desktop.
duwatch.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# watch du output every 10s, return size in KB/MB/GB, difference in KB/MB | |
# (Assumes du output is in KB) | |
set -u | |
path="${1:-.}" | |
while du -s "$path"; do sleep 10; done | | |
awk '{printf "%dK\t%dM\t%dG\t+%dK\t+%dM\n", $1, $1/1024, $1/1048576, ($1-old), ($1-old)/1024 ; old = $1}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment