View shell scripts for Linux server network traffic
When uploading a large number of files, you can use this script to implement monitoring!
#!/bin/sh ## #统计5s内的平均流量, if [ "$" = " ];then echo -" in megabytes e "\n use interface_name after the script,like \ "$0 eth0\" ... \ n " exit -1fi echo -e " \n start monitoring the $1,press \ "ctrl+c\" to stop "echo --- -------------------------------------------------------#ls /etc/sysconfig/network-scripts/|grep ifcfg|cut -d "-" -f 2 while 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 5 rx_bytes_later= ' cat /proc/net/dev|grep ' | awk ' {print $1} ' |CUT&NBsp;-d ":" -f 2 ' 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/M02/73/9E/wKioL1YCbJjRmlVnAAB-OFFQkDo842.jpg "title=" 99.jpg "alt=" Wkiol1ycbjjrmlvnaab-offqkdo842.jpg "/>
This article is from the "struggling People" blog, please be sure to keep this source http://wodemeng.blog.51cto.com/1384120/1697534
Shell script to view i/0 traffic on a Linux server network