[CentOS] df to get total disk usage on all filesystems?

Thu Aug 14 21:45:43 UTC 2008
MHR <mhullrich at gmail.com>

On Thu, Aug 14, 2008 at 2:36 PM, Nifty Cluster Mitch
<niftycluster at niftyegg.com> wrote:
>
> $ cat /tmp/checkspace
> #!/bin/bash
> df -Pkl > /tmp/checkingdiskspce
> echo -e "\nInput is:"
> cat /tmp/checkingdiskspce
> echo -e "\nAdding up the bits"
> cat /tmp/checkingdiskspce | awk '/^\/dev\// { used += $3/1024 } END { printf("%d Mb Used\n", used)} '

This is simpler (and does not involve as many execs & forks) as:

awk '/^\/dev\// { used += $3/1024 } END { printf("%d Mb Used\n",
used)} ' /tmp/checkingdiskspce

mhr