2020-12-29 08:38:07 -08:00
|
|
|
#!/usr/bin/env sh
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# YES_DASH
|
2021-09-23 06:48:05 -07:00
|
|
|
# YES_ASH
|
|
|
|
|
|
|
|
# works with busybox awk.
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
dfu() { ### @-
|
|
|
|
### pretty-print `df` in GiB.
|
|
|
|
###
|
2021-08-01 08:36:35 -07:00
|
|
|
### ```
|
|
|
|
### $ dfu
|
|
|
|
### Filesystem Used Max Left Misc
|
|
|
|
### /dev 0.00 0.46 0.46 0.00
|
|
|
|
### / 17.20 23.22 6.01 1.27
|
|
|
|
### ```
|
|
|
|
|
2021-07-29 00:37:35 -07:00
|
|
|
[ $# -le 0 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
|
|
|
|
df -xtmpfs | awk '
|
|
|
|
NR==1{printf"%-20s %7s %7s %7s %7s\n","Filesystem","Used","Max","Left","Misc"}
|
|
|
|
NR>1{printf"%-20s %7.2f %7.2f %7.2f %7.2f\n",$6,$3/2^20,($3+$4)/2^20,($4)/2^20,($2-$4-$3)/2^20}'
|
|
|
|
}
|
|
|
|
|
2021-08-02 13:48:46 -07:00
|
|
|
[ -n "${preload+-}" ] || dfu "$@"
|