Monitor Network with netstat command in Linux

0
227

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

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

Read More

If You Appreciate What We Do Here On OsRadar, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Telegram
  2. Subscribe to our email updates: Sign Up Now
  3. Become a Supporter - Make a contribution via PayPal

We are thankful for your support.

LEAVE A REPLY

Please enter your comment!
Please enter your name here