Answer the question
In order to leave comments, you need to log in
How to display the current percentage of disk usage in the terminal, similar to the Windows task manager?
Expectation:
$ <some_magick_command>
>>
sda 50%
sdb 37%
Answer the question
In order to leave comments, you need to log in
something like this:
DISK=(/dev/nvme0n1 /dev/loop0)
TIME=2
while :; do
i=$(iostat -dsxy $TIME 1 -o JSON ${DISK[*]} | jq -r '.sysstat.hosts[].statistics[].disk[] | "\(.disk_device)\t\(.util) %"')
clear
echo -n -e "$i\n"
done
loop0 0.35 %
nvme0n1 0.42 %
%util
Percentage of elapsed time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100% for devices serving requests serially. But for devices serving requests in parallel, such as RAID arrays and modern SSDs, this number does not reflect their performance limits.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question