swap-l script
From: Baby Peanut (baby_p_nut2_at_yahoo.com)
Date: 02/27/04
- Next message: Vi.: "solaris 8 - boot from DVD drive"
- Previous message: Jeff Wieland: "Re: Reading temperatures on V210/240"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Feb 2004 11:31:59 -0800
# $Id: swap-l,v 1.9 1998/08/17 14:37:34 bpeanut Exp $
# A script to improve the output of "swap -l" by making it more like
# the output of "df -k"
swap -l | awk '{
if (NR == 1)
printf "%-25s %6s %6s %7s %7s %7s %8s\n", \
$1, $2, $3, "KBytes", "Used", "Avail", "Capacity"
else {
used = $4 / 2 - $5 / 2
avail = $5 / 2
total = $4 / 2
capacity = (used * 100) / total
printf "%-25s %6s %6s %7d %7d %7d %5.0f%%\n", \
$1, $2, $3, total, used, avail, capacity
grandtotal += total; grandavail += avail; grandused += used
}
} END {
capacity = (grandused * 100) / grandtotal
printf "%-25s %6s %6s %7d %7d %7d %5.0f%%\n", \
"total", "-", "-", grandtotal, grandused, grandavail, capacity
}'
- Next message: Vi.: "solaris 8 - boot from DVD drive"
- Previous message: Jeff Wieland: "Re: Reading temperatures on V210/240"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]