Safe Log Cleanup
Delete rotated log files older than a set number of days, with a dry-run first.
$ webtoolist --script disk-usage-report
Show filesystem usage and the largest directories under a path.
diskdudfreportNo destructive commands are used by this script, but review it before running.
Dependencies: df, du, sort
#!/usr/bin/env bash
set -euo pipefail
target="${1:-.}"
top="${TOP:-10}"
[[ -d "$target" ]] || { echo "not a directory: $target" >&2; exit 1; }
echo "== filesystems =="
df -h -x tmpfs -x devtmpfs
echo
echo "== top ${top} directories under ${target} =="
du -x -h --max-depth=1 "$target" 2>/dev/null \
| sort -h \
| tail -n "$top"
./disk-usage-report /var
TOP=20 ./disk-usage-report /home
du -x stays on one filesystem, so mounted volumes are not counted twice.Related scripts
Delete rotated log files older than a set number of days, with a dry-run first.
Exit non-zero when any mounted filesystem exceeds a usage threshold.
Show reclaimable Docker space, then prune only with an explicit flag.
Locate files above a size threshold and show them largest first.