bashunixiostatsystem-monitoring

Get r/s w/s using iostat -x and Unix commands


I am working on a system monitoring project and am wondering how to get just the Device, r/s, and w/s columns returned when running iostat -x. Im sure Id have to use cut some how but my attempt at getting the 4th column (r/s) here: iostat -x | cut -f 4 is incorrect


Solution

  • Try this:

    iostat -x | awk '{print $4}'
    

    or

    iostat -x | sed '1,/Device:/d' | awk '{print $4}'