renamed: 10 ssh options for a Secure shell for Safe Data Communication.md -> 201404/10 ssh options for a Secure shell for Safe Data Communication.md renamed: 20 Funny Commands of Linux or Linux is Fun in Terminal.md -> 201404/20 Funny Commands of Linux or Linux is Fun in Terminal.md renamed: 2048 Now Available For Offline Play In Ubuntu.md -> 201404/2048 Now Available For Offline Play In Ubuntu.md renamed: "5 Command Line Tools for Downloading Files\357\274\217Torrents and Browsing Websites.md" -> "201404/5 Command Line Tools for Downloading Files\357\274\217Torrents and Browsing Websites.md" renamed: 5 Linux Distributions that Deserve more Love.md -> 201404/5 Linux Distributions that Deserve more Love.md renamed: A Beginners Guide for XP Users to Switch to Linux.md -> 201404/A Beginners Guide for XP Users to Switch to Linux.md renamed: Beautiful Zukitwo Theme Is the First One for GNOME 3.12.md -> 201404/Beautiful Zukitwo Theme Is the First One for GNOME 3.12.md renamed: Because You Can--Windows 8 GTK Theme For Linux.md -> 201404/Because You Can--Windows 8 GTK Theme For Linux.md renamed: Collectl is a powerful tool to monitor system resources on Linux.md -> 201404/Collectl is a powerful tool to monitor system resources on Linux.md renamed: "Daily Ubuntu Tips \342\200\223 Fix Black Screen In Ubuntu Guest With VirtualBox Screen Capture.md" -> "201404/Daily Ubuntu Tips \342\200\223 Fix Black Screen In Ubuntu Guest With VirtualBox Screen Capture.md" renamed: "Daily Ubuntu Tips \342\200\223 HPLIP 3.14.3 Released \342\200\223 Upgrade In Ubuntu.md" -> "201404/Daily Ubuntu Tips \342\200\223 HPLIP 3.14.3 Released \342\200\223 Upgrade In Ubuntu.md" renamed: Easily Switch Audio Sources With Sound Switcher Indicator In Ubuntu.md -> 201404/Easily Switch Audio Sources With Sound Switcher Indicator In Ubuntu.md renamed: GitHub's New Atom Text Editor Is Open Source, Sort Of, Though Not Really.md -> 201404/GitHub's New Atom Text Editor Is Open Source, Sort Of, Though Not Really.md renamed: Here Are Top 20 Linux Tutorials!.md -> 201404/Here Are Top 20 Linux Tutorials!.md renamed: How To Find IP Conflicts In Linux.md -> 201404/How To Find IP Conflicts In Linux.md renamed: How to Wipe Free Disk Space in Linux.md -> 201404/How to Wipe Free Disk Space in Linux.md renamed: How to enable 32-bit support for 64-bit Ubuntu 13.10 or greater.md -> 201404/How to enable 32-bit support for 64-bit Ubuntu 13.10 or greater.md renamed: How to set up RainLoop webmail in Ubuntu server.md -> 201404/How to set up RainLoop webmail in Ubuntu server.md renamed: How to spoof the MAC address of a network interface on Linux.md -> 201404/How to spoof the MAC address of a network interface on Linux.md renamed: Interesting facts about Raspberry Pi.md -> 201404/Interesting facts about Raspberry Pi.md renamed: Linux 3.15 Will Dramatically Reduce Suspend And Resume Times!.md -> 201404/Linux 3.15 Will Dramatically Reduce Suspend And Resume Times!.md renamed: Linux Basics--Analyze Disk Usage In Ubuntu Linux.md -> 201404/Linux Basics--Analyze Disk Usage In Ubuntu Linux.md renamed: Linux Commands Cheat Sheet in Black & White.md -> 201404/Linux Commands Cheat Sheet in Black & White.md renamed: Linux Kernel News - January and February 2014.md -> 201404/Linux Kernel News - January and February 2014.md renamed: Linux and Unix nload App - Monitor Network Traffic and Bandwidth Usage In Real Time.md -> 201404/Linux and Unix nload App - Monitor Network Traffic and Bandwidth Usage In Real Time.md renamed: Meet uGet, an Amazing Download Manager for Linux.md -> 201404/Meet uGet, an Amazing Download Manager for Linux.md renamed: Moving a city to Linux requires political backing, says Munich project leader.md -> 201404/Moving a city to Linux requires political backing, says Munich project leader.md renamed: Open Source Isn't Just For Developers Anymore.md -> 201404/Open Source Isn't Just For Developers Anymore.md renamed: Play the Best Linux Puzzle Games.md -> 201404/Play the Best Linux Puzzle Games.md renamed: Red Hat Updates Open Source Software Development Tools.md -> 201404/Red Hat Updates Open Source Software Development Tools.md renamed: Ubuntu Touch Email Client Mockup Design Looks Fantastic.md -> 201404/Ubuntu Touch Email Client Mockup Design Looks Fantastic.md renamed: Ultimate Edition 3.9 Linux Distro Is a Complete Mess.md -> 201404/Ultimate Edition 3.9 Linux Distro Is a Complete Mess.md renamed: What if Linus Torvalds Would Have Accepted Job Proposal of Steve Jobs.md -> 201404/What if Linus Torvalds Would Have Accepted Job Proposal of Steve Jobs.md renamed: What is good video editing software on Linux.md -> 201404/What is good video editing software on Linux.md renamed: Windows 7 & 8 Complete Transformation Pack Out for Ubuntu, Debian 8, and Arch Linux.md -> 201404/Windows 7 & 8 Complete Transformation Pack Out for Ubuntu, Debian 8, and Arch Linux.md renamed: nSnake--Play The Classic Snake Game In Linux Terminal.md -> 201404/nSnake--Play The Classic Snake Game In Linux Terminal.md
4.4 KiB
在 Linux/UNIX 终端下使用 nload 实时监控网络流量和带宽使用
如果你想在命令行界面监控网络吞吐量,nload 应用程序是个不错的选择。它是一个实时监控网络流量和带宽使用的控制台应用程序,使用两个图表可视化地展示接收和发送的流量,并提供诸如数据交换总量、最小/最大网络带宽使用量等附加信息。
###安装###
在 CentOS/RHEL/Red Hat/Fedora Linux 上安装 nload
首先在 CentOS 或者基于 RHEL 的操作系统上启用 EPEL 仓库,然后键入 yum 命令安装 nload:
# yum install nload
在 Debian 或者 Ubuntu Linux 上安装 nload
键入 apt-get 命令:
$ sudo apt-get install nload
在 FreeBSD 操作系统上安装 nload
通过 port 安装 nload,键入:
# cd /usr/ports/net/nload/ && make install clean
或者添加包
# pkg install net/nload
在 OpenBSD 操作系统上安装 nload
键入下列命令:
$ sudo pkg_add -i nload
在类 Unix 操作系统上从源代码安装 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 显示当前网络使用量呢?
基本语法是:
nload
nload device
nload [options] device1 device2
键入下列命令:
$ nload
$ nload eth0
$ nload em0 em2
会得到输出:
图01: 使用 nload 命令
操控 nload 应用程序
nload 命令一旦执行就会开始监控网络设备,你可以使用下列快捷键操控 nload 应用程序。
- 你可以按键盘上的 ← → 或者 Enter/Tab 键在设备间切换。
- 按 F2 显示选项窗口。
- 按 F5 将当前设置保存到用户配置文件。
- 按 F6 从配置文件重新加载设置。
- 按 q 或者 Ctrl+C 退出 nload。
设置显示刷新间隔
默认每 100 毫秒刷新一次显示数值,下面的例子将时间间隔设置成 500 毫秒:
$ nload -t {interval_number_in_millisec}
$ nload -t 500
输出:
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 工具。
译自: http://www.cyberciti.biz/networking/nload-linux-command-to-monitor-network-traffic-bandwidth-usage/