Monitoring network usage in Linux can be accomplished using various command-line tools that provide insights into network traffic, bandwidth usage, and active connections. Here are some commonly used tools and how to use them:
1. Using ifstat
ifstat is a simple tool that displays network interface statistics in real-time.
-
Install
ifstat(if not already installed):sudo apt install ifstat -
Basic Usage:
ifstat
This command will show the incoming and outgoing traffic for all network interfaces.
2. Using nload
nload is a console application that visualizes network traffic in real-time.
-
Install
nload:sudo apt install nload -
Basic Usage:
nload
This command will display a graphical representation of incoming and outgoing traffic for each network interface.
3. Using iftop
iftop is a real-time console-based network bandwidth monitoring tool that shows bandwidth usage on an interface.
-
Install
iftop:sudo apt install iftop -
Basic Usage:
sudo iftop
This command will show a list of connections and their bandwidth usage.
4. Using vnstat
vnstat is a network traffic monitor that keeps a log of network usage over time.
-
Install
vnstat:sudo apt install vnstat -
Start the vnstat service:
sudo systemctl start vnstat -
Basic Usage:
vnstat
This command will display the total data transferred over the network interfaces since the last reset.
5. Using netstat
netstat provides information about network connections, routing tables, and interface statistics.
- Basic Usage:
netstat -tuln
This command shows active TCP and UDP connections along with their listening ports.
Summary
ifstat: Real-time interface statistics.nload: Visualizes network traffic.iftop: Monitors bandwidth usage per connection.vnstat: Logs network usage over time.netstat: Displays active connections and routing information.
Further Learning
To deepen your understanding of network monitoring, consider exploring relevant labs on LabEx that focus on network management and performance monitoring techniques.
If you have any more questions or need further clarification, feel free to ask!
