Analyzing and monitoring the network traffic of an entire network infrastructure is a very important task for every Linux system administrator. Network admin needs to see what’s going on with the network, who’s using the bandwidth, and how their entire network infrastructure is handling the load. The good thing is there are many open-source network monitoring and traffic analysis tools available in Linux.
In this post, we will discuss some Linux command line tools that can be used to monitor the network usage.
Also read: How to Use tcpdump for Packet Capture
Nload
Nload is a console application that allows users to monitor the incoming and outgoing traffic separately.
It visualizes the incoming and outgoing traffic using two graphs and provides additional info like total amount of transferred data and min/max network usage.
You can install nload
by running the following command:
sudo apt-get install nload
Now run the nload command:
sudo nload
Once the nload command is executed, you should see the following output.
Iptraf
Iptraf is an ncurses-based IP LAN monitoring tool that shows individual connections and the amount of data flowing between the hosts.
To install iptraf
, run the following:
sudo apt-get install iptraf
Once iptraf
has been installed, issue the following command:
sudo iptraf
You should see the following output.
Vnstat
Vnstat is different from most of the other tools. It is a console-based network traffic monitor for Linux that runs as a daemon and keeps a log of network traffic for the selected interface. It can be used to generate a report of the network usage.
You can install vnstat
by running the following command:
sudo apt-get install vnstat
Now, run vnstat
without any argument:
sudo vnstat
You can see the total amount of data transfer on your network.
If you want to monitor the bandwidth usage in realtime, use the -l
option. It will display the total bandwidth used by incoming and outgoing data.
Now, run vnstat
to monitor the bandwidth usage on the wlan0 interface:
sudo vnstat -l -i wlan0
You will see the following output.
Speedometer
Speedometer is a command line utility that can be used to monitor the current download/upload speeds of the network connections and the speeds of the file systems. Speedometer shows a graph of your current and past network speed in your console. You can also use speedometer directly on a file to monitor the download performance and history of a specific download instead of all the network traffic.
Run the following command to install speedometer
in your system:
sudo apt-get install speedometer
Now, run speedometer
on wlan0
interface:
sudo speedometer -r wlan0 -t wlan0
You will see an output similar to the following.
Iftop
Iftop is a command line tool that listens to network traffic on a given interface (such as eth0, eth1, wlan0) and shows a table of current bandwidth usage by hosts. Iftop uses the pcap library to capture the incoming and outgoing packets of the network interface.
You can easily install iftop
by running the following command:
sudo apt-get install iftop
Now, run iftop
with the n
option that prevents iftop from resolving ip addresses to hostname:
sudo iftop -n
You will see the following output.
Conclusion
I hope this post will be helpful to quickly check the network bandwidth on your Linux server. Feel free to leave a comment if you have any questions.
Over 5 years of experience as IT system administrator for IT company in India. My skills include a deep knowledge of Rehat/Centos, Ubuntu nginx and Apache, Mysql, Subversion, Linux, Ubuntu, web hosting, web server, squied proxy, NFS, FTP, DNS, Samba, ldap, Openvpn, Haproxy, Amazon web services, WHMCS, Openstack Cloud, Postfix Mail Server, Security etc.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe