本文主要介绍Linux操作系统中iftop命令的常见用法。
1 概述
Linux操作系统中的iftop命令来自iftop软件包。iftop软件包的描述如下:
Command line tool that displays bandwidth usage on an interface
Manual中对于iftop的介绍信息如下:
iftop - display bandwidth usage on an interface by host.
iftop listens to network traffic on a named interface, or on the first interface it can find which looks like an external interface if none is specified, and displays a table of current bandwidth usage by pairs of hosts. iftop must be run with sufficient permissions to monitor all network traffic on the interface; see pcap(3) for more information, but on most systems this means that it must be run as root.
总结上述介绍信息,可知:iftop用于显示网口上的带宽流量信息。
2 常见用法
本章介绍iftop命令的常见用法。
2.1 显示ip信息代替主机名
iftop -n
2.1 显示指定ip的流量信息
首先,运行“iftop -n”命令,显示的示例结果如下:
上面的结果默认显示了所有ip的流量信息。
现在想只显示ip地址“192.168.110.7”的流量信息,操作步骤如下。
1. 在上面的显示结果界面中,输入“l”,此时屏幕中会出现“Screen filter”待输入状态,如下图所示:
2. 输入指定的ip地址信息(本例中为“192.168.110.7”),输入的内容会填充到“Screen filter”,如下图所示:
3. 按下Enter键确认。
完成上述操作后,即可只监控指定ip地址的流量信息,如下图所示: