A while back I needed a warning system for when my backups disk runs out of free space.
Gathering information from various other existing scripts, I wrote a small Perl script that check the available space and send warning emails if it drops below a defined level.
One may want to see the disk space used by each item (be it subdirectory or file) in a directory in a Linux environment. There are several ways to do that:
for f in `ls`; do du -hs $f; done
This works in most cases but has the minus that it fails if any of the items have spaces in their names. A workaround…