參數(shù)命令 | 作用 |
---|---|
-i iface | 網(wǎng)絡(luò)接口:立即在指定網(wǎng)絡(luò)接口上開啟IP流量監(jiān)視,iface為all指監(jiān)視所有的網(wǎng)絡(luò)接口,iface指相應(yīng)的interface |
-g | 立即開始生成網(wǎng)絡(luò)接口的概要狀態(tài)信息 |
-d iface | 網(wǎng)絡(luò)接口:在指定網(wǎng)絡(luò)接口上立即開始監(jiān)視明細的網(wǎng)絡(luò)流量信息,iface指相應(yīng)的interface |
-s iface | 網(wǎng)絡(luò)接口:在指定網(wǎng)絡(luò)接口上立即開始監(jiān)視TCP和UDP網(wǎng)絡(luò)流量信息,iface指相應(yīng)的interface |
-z iface | 網(wǎng)絡(luò)接口:在指定網(wǎng)絡(luò)接口上顯示包計數(shù),iface指相應(yīng)的interface |
-l iface | 網(wǎng)絡(luò)接口:在指定網(wǎng)絡(luò)接口上立即開始監(jiān)視局域網(wǎng)工作站信息,iface指相應(yīng)的interface |
-t timeout | 時間:指定iptraf指令監(jiān)視的時間,timeout指監(jiān)視時間的minute數(shù) |
-B | 將標(biāo)注輸出重新定向到“/dev/null”,關(guān)閉標(biāo)注輸入,將程序作為后臺進程運行 |
-L logfile | 指定一個文件用于記錄所有命令行的log,默認文件是地址:/var/log/iptraf |
-I interval | 指定記錄log的時間間隔(單位是minute),不包括IP traffic monitor |
-u | 允許使用不支持的接口作為以太網(wǎng)設(shè)備 |
-f | 清空所有計數(shù)器 |
-h | 顯示幫助信息 |
方法五、watch ifconfig
watch命令可以反復(fù)的執(zhí)行一個命令,默認時間間隔為2秒鐘。
watch ifconfig 可以每隔兩秒監(jiān)視網(wǎng)絡(luò)狀態(tài)、
watch -d ifconfig 可以每隔兩秒監(jiān)視網(wǎng)絡(luò)狀態(tài), 并標(biāo)記發(fā)生變化的部分
watch -d ifconfig eth0 可以每隔兩秒只監(jiān)視 網(wǎng)卡eth0, 并標(biāo)記發(fā)生變化的部分
watch -d 'ifconfig eth0 | grep bytes' 可以每隔一秒只監(jiān)視網(wǎng)卡eth0,只顯示流量部分,并標(biāo)記發(fā)生變化的部分
watch也可以用來查看文件變化的情況,例如:
例如 watch ls -la file,這條命令的意思是沒兩秒察看 file1的文件大小變化情況。
退出: ctrl+c
watch命令詳解
NAME
watch - execute a program periodically, showing output fullscreen
SYNOPSIS
watch [-dhvt] [-n seconds>] [--differences[=cumulative]] [--help] [--interval=seconds>] [--no-title] [--version] command>
DESCRIPTION
watch runs command repeatedly, displaying its output (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use -n or --interval to specify a different interval.
The -d or --differences flag will highlight the differences between successive updates. The --cumulative option makes highlighting "sticky", presenting a running display of all positions that have ever changed. The -t or --no-title option turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line. watch will run until interrupted.
NOTE
Note that command is given to "sh -c" which means that you may need to use extra quoting to get the desired effect.
Note that POSIX option processing is used (i.e., option processing stops at the first non-option argument). This means that flags after command don't get interpreted by watch itself.
EXAMPLES
To watch for mail, you might do: watch -n 60 from
To watch the contents of a directory change, you could use: watch -d ls -l
If youre only interested in files owned by user joe, you might use: watch -d 'ls -l #124; fgrep joe'
You can watch for your administrator to install the latest kernel with: watch uname -r (Just kidding.)呵呵
BUGS
Upon terminal resize, the screen will not be correctly repainted until the next scheduled update. All --differences highlighting is lost on that update as well.
Non-printing characters are stripped from program output. Use "cat -v" as part of the command pipeline if you want to see them.
方法六、
watch cat /proc/net/dev
標(biāo)簽:淘寶邀評 滄州 河池 榆林 保定 山南 河北 樂山
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《linux中查看網(wǎng)卡流量六種方法》,本文關(guān)鍵詞 linux,中,查看,網(wǎng)卡,流量,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。