This article is based on Network monitoring. I will share some commands which will provide you the details of Network bandwidth usage. These are the best commands to get a quick look about your network usage. These commands will monitor network bandwidth incoming and outgoing traffic separately.
Some commands provide the details of the process which used the network bandwidth. This will help you to understand which process utilize the higher network.
Check out below list of commands with their explanation.
Nload command line tool which is used to monitor network bandwidth with incoming and outgoing traffic separately. The nload tool is easy to use and does not support any options.
If you want to take a quick look of incoming/outgoing traffic then nload will be the good option.
$ apt-get install nload$ nload
Bmon is similar to nload but bmon will provide you some more details. bmon (Bandwidth monitor) is another tool to monitor bandwidth on a linux machine.
The output of bmon tool also provides a graph and packet details. you can choose ethernet option by up/down arrow to check bandwidth on the graph.
Also, you can choose “d” option for extra details of network usage.
$ apt-get install bmon$ bmon
vnstat is a different tool from other tools. It will run as a background process or daemon. Keep storing the size of data transfer all the time. You can be checked the history of network bandwidth usage with the help of vnstat.
When you run this vnstat first time it will give you warning message “eth3: Not enough data available yet”. Try this command after some time so the vnstat will gather some details related to network usage.
If you want the current status of network usage then run below command with some options.
$ vnstat -l -i eth3
ifstat provide network usage in batch style mode. Use below command of ifstat which gives you bandwidth with details of Time, data transfer In/Out etc.
We have used “-t” and “-i” option with ifstat command. -t provide the time and -i is used to mentioning ethernet.
$ ifstat -t -i eth0
Output: Time eth3
HH:MM:SS KB/s in KB/s out
17:54:13 5.69 1.40
17:54:14 3.16 0.18
17:54:15 1.66 0.00
17:54:16 2.21 0.06
17:54:17 3.98 0.12
17:54:18 2.84 0.00
dstat is a versatile resource statistics tool. dstat provide you details in columns and clearly shows in what magnitude and unit are displayed. It will show stats in exactly with the same timeframe. It is written in python. You can use the option to indicate different values with different colors. You can check “man page” for multiple options.
$ apt-get install dstat$ dstat
If you use only dstat command it will give you complete information like total-CPU-usage, dsk/total, net/total, paging etc.
iftop listens or provide info on network traffic. It will display the traffic by pairs of hosts. iftop reports a bandwidth on individual connections.
Run below command to install iftop on a linux machine.
$ apt-get install iftop$ iftop -n
Use below options with iftop :
-h display this message
-n don’t do hostname lookups
-N don’t convert port numbers to services
-p run in promiscuous mode (show traffic between other
hosts on the same network segment)
-b don’t display a bar graph of traffic
-B Display bandwidth in bytes
-I interface listen on named interface
-f filter code uses filter code to select packets to count
(default: none, but only IP packets are counted)
-F net/mask show traffic flows in/out of IPv4 network
-G net6/mask6 show traffic flows in/out of IPv6 network
-l display and count link-local IPv6 traffic (default: off)
-P show ports as well as hosts
-m limit sets the upper limit for the bandwidth scale
-c config file specifies an alternative configuration file
Iptraf is basically a console-based network monitor tool for Linux. It will provide a variety of information like TCP connection, interface statistics, TCP/UDP traffic breakdowns etc. it is an interactive and colorful IP monitor. It provides unique connections and the data usage between hosts.
$ apt-get install iptraf$ iptraf
tcptrack is used to monitor tcp connection on the network. It will show information such as bandwidth usage, state, source/destination addresses etc. Command output is much like the top command. you can check multiple options with “man pages”. tcptrack uses pcap library to capture and calculates packet.
$ apt-get install tcptrack$ tcptrack -i eth0 -t
Output: Client Server State Idle A Speed
192.168.6.110:34370 192.168.4.78:4949 SYN_SENT 1s 0 B/s
192.168.3.39:41533 188.8.131.52:443 ESTABLISHED 6s 0 B/s
192.168.3.39:38335 184.108.40.206:443 ESTABLISHED 17s 0 B/s
192.168.6.110:36804 192.168.4.208:4949 SYN_SENT 1s 0 B/s
192.168.3.39:48362 220.127.116.11:443 CLOSING 5s 0 B/s
192.168.6.110:54936 192.168.4.207:4949 SYN_SENT 1s 0 B/s
the speedometer is simple network bandwidth tool which draws nice graphs of incoming and outgoing traffic. the speedometer is written in python language. it is working on python-urwid library. It will provide you a graph of receive/transfer bytes in the interface.
Netload is simple network bandwidth tool. it will provide you only small report on traffic load and how much bytes are transferred since the command is running.
it is part of netdiag.
$ apt-get install netdiag$ netload eth0
I hope you like the article if you find any difficulties using monitor network bandwidth command then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.
Welcome to TechThings.
I'm Prashant Thorat, a tech-blogger from Mumbai, India.
I started Techthings as a passion and to share my knowledge about technologies.
Here at Techthings I write about Linux technologies, Aws Cloud, Wordpress blogging and scripting knowledge.
You can read more about me at About us page.
Thank You :)