Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Top Linux commands to monitor NETWORK

Recommended Read: How to Execute a Command or a Script on system Startup or Reboot

Also Read: Learn to use KILL COMMAND in Linux

In this tutorial, we will only discuss Linux commands to monitor network traffic. On some Linux distributions these commands might be installed by default, but on some they might need to be installed. So let’s start by discussing the pre-requisites first.

Pre-Requisites

We need to have EPEL repository installed on our system in order to install some of these commands. We do have a nice, detailed article for installation of the same HERE https://thelinuxgurus.com/install-epel-repository-on-centos-rhel-6-7-8/. You can also use the commands below to install EPEL repository on your systems,

RHEL/CentOS 6:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

RHEL/CentOS 7:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Epel also recommends for RHEL 7, to enable the optional, extras, and HA repositories since EPEL packages may depend on packages from these repositories, using the following command,

# subscription-manager repos –enable “rhel-*-optional-rpms” –enable “rhel-*-extras-rpms” –enable “rhel-ha-for-rhel-*-server-rpms”

RHEL/CentOS 8:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Now let’s discuss the Linux commands to monitor network one by one.


Netdiag utility

Netdiag is itself not a command itself but is a collection of network diagnostics tools. The commands like netwatch, trafshow & netload commands are all part of it & are also discussed in this article below.

RHEL/CentOS

# yum install netdiag

Fedora

# dnf install netdiag

Ubuntu/Debian

# apt-get install netdiag


Nload command

Nload command is used to fetch information about the incoming & outgoing traffic. It generates a graph that indicates the incoming and outgoing traffic. Nload command does not support many options i.e. we won’t get much information related to individual processes but we can adjust the scale.

So to Install it, use the following command,

RHEL/CentOS (need to have EPEL repo installed)

# yum install nload

Fedora

# dnf install nload

Ubuntu/Debian

# apt-get install nload

Now to start using it, run

# nload


Netwatch command

Netwatch command shows the total speed at which data transfer for each connection from the local system to the remote systems. If need to check the transfer speed from an interface, we can use the following command,

# netwatch -e en0sp3 -nt


Iftop command

Iftop command is one of the most useful Linux commands to monitor networks. It provides real-time monitoring of network bandwidth & provides the total data moving in & out of the individual socket connections i.e. it captures packets moving in and out from our network adapters & then it sums up to find the total bandwidth being utilized by a server.

Run the following command from your terminal to install it your server,

RHEL/CentOS (need to have EPEL repo installed)

# yum install iftop

Fedora

# dnf install iftop

Ubuntu/Debian

# apt-get install iftop

Then to start monitoring the network, run the following command,

# iftop

For more detailed information on the options that can be used with iftop, use command help,

# iftop –help


tcptrack command

tcptrack command is very similar to the iftop command. Tcptrack captures packets & then calculates the network bandwidth for each of the tcp connections. To calculate the network bandwidth, it uses the pcap library.
To install it on your systems, use the following command,

RHEL/CentOS

# yum install tcptrack

Fedora

# dnf install tcptrack

Ubuntu/Debian

# apt-get install tcptrack

To get the network stats, open terminal & run the following command,

# tcptrack


Iptraf commands

Another one of the useful network monitoring commands. Iptraf generates a colorful & interactive list of traffic in & out to/from other servers/hosts. The list has information about all the hosts from which traffic is going in & out.
To install it on the system, use one of the following commands,

RHEL/CentOS (need to have EPEL repo installed)

# yum install iptraf-ng

Fedora

# dnf install iptraf-ng

Ubuntu/Debian

# apt-get install iptraf-ng

To generate the network traffic reports, run the following command,

# iptraf


Netload command

Of all the commands that are part of netdiag package, netload is simplest to use & understand as it provides only a simple report on current network traffic from the system. It also shows the total amount of data transferred since its start.

To get the netload report, run the netload command followed by the ethernet port name. For example,

# netload en0sp3


Trafshow commands

Trafshow command is similar to the tcptrack command. It can filter the traffic based on pcap filters & shows data transfer speed of all active connections along with the protocol, tcp/udp.
To use it, execute the following command from the terminal,

# trafshow -i en0sp3 udp

These were some of the commands that we can use to monitor our Linux system network. We will also discuss some other commands to monitor system memory, CPU & disk usage in our future tutorials. Please feel free to send us any questions or queries using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Top Linux commands to monitor NETWORK appeared first on The Linux GURUS.



This post first appeared on The Linux GURUS, please read the originial post: here

Share the post

Top Linux commands to monitor NETWORK

×

Subscribe to The Linux Gurus

Get updates delivered right to your inbox!

Thank you for your subscription

×