Friday, November 7, 2014

Convert a list of decimal numbers into hex (Solaris/UNIX)

Another one liner that came in handy today:

for x in $(cat my_dec_list); do echo "obase=16; ${x}" | bc; done >> my_hex_list

Total size of all disk presented to a UNIX server

I needed a way to add up the total storage presented to a few UNIX machines. Here's what I came up with:

# iostat -En | grep Size | awk {'print $6'} | sed s/GB// | awk '{s+=$1} END {print "Total Storage: "s "GB"}'

The result is:

Total Storage: 8398.69GB