Skip to content

Instantly share code, notes, and snippets.

@oxagast
Last active October 17, 2025 01:14
Show Gist options
  • Save oxagast/f2941fe4fa19f2a25028ac2dda6fa4b3 to your computer and use it in GitHub Desktop.
Save oxagast/f2941fe4fa19f2a25028ac2dda6fa4b3 to your computer and use it in GitHub Desktop.
File Growth Watcher
#!/usr/bin/bash
# oxagast / [email protected]
if [[ $# -eq 1 ]] || [[ $# -eq 2 ]]; then
if [[ $# -eq 1 ]]; then
ESIZE=1000000000000000000;
fi
if [[ $# -eq 2 ]]; then
ESIZE=$2;
fi
while test -s $1 && [[ $ESIZE -ge $(stat --printf "%s" $1) ]]; do
stat --printf "%s" $1 | numfmt --to-unit M --format "%.2f" | xargs printf "\rSize: %8.2fmb | $1"
sleep 0.3 ;
done
else
echo "useage: $0 [filename] [target size in bytes]";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment