如果你想在命令行界面监控网络吞吐量,nload 应用程序是个不错的选择。它是一个实时监控网络流量和带宽使用的控制台应用程序,使用两个图表可视化地展示接收和发送的流量,并提供诸如数据交换总量、最小/最大网络带宽使用量等附加信息。
首先在 CentOS 或者基于 RHEL 的操作系统上启用 EPEL 仓库,然后键入 yum 命令安装 nload:
# yum install nload键入 apt-get 命令:
$ sudo apt-get install nload通过 port 安装 nload,键入:
# cd /usr/ports/net/nload/ && make install clean或者添加包
# pkg install net/nload键入下列命令:
$ sudo pkg_add -i nload首先,使用 wget 或者 curl 命令获取源代码:
$ cd /tmp $ wget http://www.roland-riegel.de/nload/nload-0.7.4.tar.gz使用 tar 命令解压缩名为 nload-0.7.4.tar.gz 的 tar 包,键入:
$ tar xvf nload-0.7.4.tar.gz使用 cd 命令进入 nload 源代码所在目录:
$ cd nload*然后键入 ./configure 为你的操作系统配置安装包:
$ sh ./configure或者
$ ./configure运行 configure 命令需要一点时间。完成后,使用 make 命令编译 nload:
$ make最后,键入 make install 命令以 root 用户身份安装 nload 应用程序和相关文件:
$ sudo make install或者
# make install如何使用 nload 显示当前网络使用量呢?
基本语法是:
nloadnload device nload [options] device1 device2键入下列命令:
$ nload$ nload eth0$ nload em0 em2会得到输出:
图01: 使用 nload 命令
nload 命令一旦执行就会开始监控网络设备,你可以使用下列快捷键操控 nload 应用程序。
你可以按键盘上的 ← → 或者 Enter/Tab 键在设备间切换。按 F2 显示选项窗口。按 F5 将当前设置保存到用户配置文件。按 F6 从配置文件重新加载设置。按 q 或者 Ctrl+C 退出 nload。默认每 100 毫秒刷新一次显示数值,下面的例子将时间间隔设置成 500 毫秒:
$ nload -t {interval_number_in_millisec} $ nload -t 500输出:
Animated gif 01 - nload command in action
GIF 动画 01 - 使用 nload 命令
语法如下:
$ nload -u h|H|b|B|k|K|m|M|g|G $ nload -U h|H|b|B|k|K|m|M|g|G $ nload -u h $ nload -u G $ nload -U G释义:
小写选项 -u: h 意为自动格式化为人类易读的单位,b 意为 Bit/s,k 意为 kBit/s,m 意为 MBit/s,g 意为 GBit/s。大写字母意为使用 Byte 替代 Bit。默认为 k。大写选项 -U 与小写选项 -u 非常相似,不同之处在于它展示的是数据量,比如 Bit, kByte, GBit 等等。(没有 "/s")。默认值是 M。我觉得 nload 是一个稳定可靠的应用程序,如果你喜欢 nload,你可能也想试试 Linux 和其他类 Unix 操作系统环境下的 vnstat 与 iftop 工具。
原文发布时间为:2014-04-18
本文来自云栖社区合作伙伴“Linux中国”
相关资源:敏捷开发V1.0.pptx