show the disk usage of tagged cache directories

du -h --total (dirname (find . -name CACHEDIR.TAG))

useful for totaling rustc compilation caches

remove tagged cache directories older than 3 days

dirname (find . -mtime +72 -name CACHEDIR.TAG) | xargs rm -r

always test your mass deletion commands without rm in order to see what they will delete

send notification when the running command finishes

^Z fg; notify-send 'done'

ctrl-z in a terminal will pause the currently running command. fg will resume the command and wait until it is finished.

redirect both stdout and stderr to a file

somecommand &>/dev/null

for each submodule that does not have local changes, update it and discard all but the latest commit.

git submodule foreach sh -c 'git log --branches --not --remotes --format=%H | wc -l | grep -F "0" && git fetch --depth=1 && git reflog expire --expire=all --all && git gc --prune=now; true'