#!/bin/bash # ------------------------------------------------------------------------------- # Filename: netflood.sh # Revision: 1.2 # Date: 2007/08/30 # Author: Ajian # Email: ajian521#gmail.com # Website: www.ohlinux.com # Description: LAN traffic monitor # ------------------------------------------------------------------------------- # Copyright: 2009 (c) Ajian # License: GPL # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # ------------------------------------------------------------------------------- #Version 1.1 2007/08/30 #create the script #Version 1.2 2008/01/10 #modify the script and add the variable. NIC=eth1 while : ; do time=`date +%m"-"%d" "%k":"%M` day=`date +%m"-"%d` rx_before=`ifconfig $NIC|sed -n "8"p|awk '{print $2}'|cut -c7-` tx_before=`ifconfig $NIC|sed -n "8"p|awk '{print $6}'|cut -c7-` sleep 2 rx_after=`ifconfig $NIC|sed -n "8"p|awk '{print $2}'|cut -c7-` tx_after=`ifconfig $NIC|sed -n "8"p|awk '{print $6}'|cut -c7-` rx_result=$[(rx_after-rx_before)/256] tx_result=$[(tx_after-tx_before)/256] echo "$time Now_In_Speed: "$rx_result"kbps Now_OUt_Speed: "$tx_result"kbps" sleep 2 done
实时输出linux网卡流量信息
转载
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
linux下安装iftop监控网卡实时流量
linux下安装iftop监控网卡实时流量
linux linux下安装iftop监控网卡实时流 -
查看网卡的实时流量
宅鸟在工作中有时需要查看指定网卡流量状况,这里分享一个脚本
网卡 流量 bash -
AIX查看网卡实时流量
本文主要介绍aix查看实时流量
aix 网卡流量