In this post, we will discuss some Linux command line tools that can be used to monitor the network usage.
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: Now run the nload command: 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: Once iptraf has been installed, issue the following command: 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: Now, run vnstat without any argument: 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: 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: Now, run speedometer on wlan0 interface: 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: Now, run iftop with the n option that prevents iftop from resolving ip addresses to hostname: 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.