Previously wrote a view of the Linux server current traffic small script, very simple, but can intuitively give us some information
#!/bin/sh## #统计10s内的平均流量, if [ "$" = " ];then echo -e" in megabytes "\n use interface_name after the script,like \ "$0 eth0\" ... \ n " exit -1fiecho -e " \n start monitoring the $1,press \ "ctrl+c\" to stop "echo --------- -------------------------------------------------#ls /etc/sysconfig/network-scripts/|grep ifcfg|cut -d "-" -f 2while true do rx_bytes= ' cat /proc/net/dev|grep "$" |awk ' {print $1} ' |cut -d ": -f 2 ' tx_bytes= ' cat /proc/net/dev|grep ' $ ' |awk ' {print $9} ' sleep 10 rx_bytes_later= ' cat /proc/net/dev|grep ' $ ' |awk ' {print $1} ' |cut -d ":" -f 2 ' &nbsP; tx_bytes_later= ' cat /proc/net/dev|grep ' $ ' |awk ' {print $9} ' ## #Mb =b*8/1024/1024 speed_rx= ' echo ' scale=2; ($RX _bytes_later - $RX _bytes ) *8/1024/1024/10 "|BC ' speed_tx= ' echo " scale=2; ($TX _bytes_later - $TX _bytes) *8/ 1024/1024/10 "|BC ' printf "%-3s %-3.1f %-10s %-4s %-3.1f %-4s\n " IN: $speed _rx mb/s out: $speed _tx mb/s done
Use effects such as
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/4A/wKioL1X5cqbx0zQzAACEQKvxtAM837.jpg "title=" QQ picture 20150916213625.png "alt=" Wkiol1x5cqbx0zqzaaceqkvxtam837.jpg "/>
View shell scripts for Linux server network traffic