5.1 C
Texas
Muhammad Nabeel
Network and System Administrator

Monitor Network with netstat command in Linux

netstat (network statistics) is a command-line network tool that displays network connections for Transmission Control Protocol (both incoming and outgoing). It is also monitor routing tables, number of network interface and protocol statistics. netstat is available on Linux operating systems.

We can use it for finding problems in the network and to determine the amount of traffic on the network as a performance measurement. It is very useful tool for monitoring and diagnosing connection problems.

Intsall netstat

In case, you are unable to use netstat command, use below command to install it.

yum install -y net-tools
- Advertisement -

Now it is installed and ready to use.
Below are some useful commands to monitor network connections.

Display network interfaces

You can run below command to see all available network interfaces on the server.

netstat -i

Print all TCP and UDP listening Ports

Now, if you want to see all listening ports on the server, use below command.

netstat -a | more

List only TCP Ports connections

so, issue following command to see all TCP connections.

netstat -at

Show only UDP Ports connections

Then, run following command to see all UDP connections.

netstat -au

List services names with PID

Then, see all services with their process ID’s

netstat -pt

Display kernel routing information

Use below command so you can see kernel routing information.

netstat -r

Print Netstat Information Continuously

netstat -c

Finding Listening service

Note: Replace ssh with your service name.

netstat -ap | grep ssh

That’s it, to get more information and options about netstat command read manual for netstat command using “man netstat” command

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article