You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shell-project/os-test/netflow.sh

14 lines
428 B

2 years ago
#!/usr/bin/bash
<<!
网络速率检测脚本,实时检测网络流量
!
echo "ens33:"
while :
do
OLD_in=$(awk '$0 ~ "ens33"{print $2}' /proc/net/dev)
OLD_out=$(awk '$0 ~ "ens33"{print $10}' /proc/net/dev)
sleep 2
in=$(awk '$0 ~ "ens33"{print $2}' /proc/net/dev)
out=$(awk '$0 ~ "ens33"{print $10}' /proc/net/dev)
echo -e "in: $[($in - $OLD_in) /1024] KB/s\nout: $[($out - $OLD_out) /1024] KB/s"
done