This article describes some of the Linux command-line tools that you can use to monitor network usage. These tools can monitor data transmitted over a network interface and measure the speed at which data is being transmitted. The inbound traffic is displayed separately from the outbound traffic.
Some commands can show the bandwidth used by a single process. This makes it easy for users to discover a process that is over-using network bandwidth.
These tools use different mechanisms to produce traffic reports. Some tools, such as nload, can read "Proc/net/dev" files for traffic statistics, while some tools use Pcap libraries authoring to capture all packets and then calculate the total amount of data to estimate the traffic load.
Here is the command name by function.
- Monitor overall bandwidth using ――nload, Bmon, Slurm, Bwm-ng, CBM, speedometer, and netload
- Monitor overall bandwidth usage (batch output) ――vnstat, Ifstat, Dstat, and Collectl
- Bandwidth per socket connection using ――iftop, Iptraf, Tcptrack, Pktstat, Netwatch, and Trafshow
- Bandwidth usage for each process ――nethogs
1. nload
Nload is a command-line tool that allows users to separate and monitor both inbound and outbound traffic. It can also draw charts to show inbound traffic and outbound traffic, and the view scale can be adjusted. It is simple to use and does not support many options.
Press Enter or left and RIGHT arrow keys to switch the NIC.
So, if you just need to quickly see the total bandwidth usage without the details of each process, then nload is handy.
Device eth1 [SSF] (2/3):============================================================================================================Incoming:curr:1.05mbit/S.| . . .. . . .. .. .. Avg:1.43mbit/S.. ....| ##... .|| ####|### #|#####|##|######| ##|############|## Min:62.39kbit/s|##########.. ##################|###################.###################| Max:2.56mbit/s######################################################################## TTL:127.19Gbyteoutgoing:curr:554.77kbit/s AVG:935.93kbit/S. . Min:24.39kbit/s ... ..||.| ##......||| ###|### .#|###|#|##|#|#|##| ##||| ##|#|##|#|||. Max:1.38mbit/s############|######################################|#################### TTL:7.56GByte
Server bandwidth if metered: traffic to the cloud server is free, such as downloading files from the Internet via a cloud server, without charge, and only traffic from the server to the Internet will incur charges.
Monitoring network bandwidth commands on Linux servers