I'm trying to obtain the current disk I/O usage (in %) from a single command.
Currently I have
iostat -dx /dev/sda 1 | awk {'print $16'}
which gives me the utilization entry for I/O from iostat
. It also keeps updating and giving new entries, that's something I don't want:
%util
0.06
%util
0.00
%util
0.09
What i'm trying to get is just a single line that gives the current I/O usage in percentage. so its output would simply look like this:
0.06
18.04
could that explain column 14 vs 16? – WinEunuuchs2Unix May 16 '19 at 22:55iostat
users to know 16.04=14 and 18.04=16. BTW I just wrote a script right up your CPU alley: https://askubuntu.com/questions/1141605/how-can-i-control-cpu-usage-on-a-chuwi-hi10-pro/1142671#1142671 – WinEunuuchs2Unix May 16 '19 at 23:20awk
call using$NF
to print the last column no whatter which number this is:iostat -dxy 2 1 /dev/sda | awk '/sda/{print $NF}'
– dessert May 17 '19 at 07:30