#41 Figuring Out Available Disk Space
Related to disk quota management is the simpler question of how much disk space is available on the system. The df command reports disk usage on a per-disk basis, but the output can be a bit baffling:
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/hdb2 25695892 1871048 22519564 8% / /dev/hdb1 101089 6218 89652 7% /boot none 127744 0 127744 0% /dev/shm
What would be much more useful is a version of df that summarizes the available capacity values in column four and then presents the summary in a way that is easily understood. It's a task easily accomplished in a script.
The Code
#!/bin/sh # diskspace - Summarizes available disk space and presents it in a logical # and readable fashion. ...
Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.