netstat command in linux with examples

0 Comment

Netstat command stands for network statistics  netstat command is used to display network connections

Netstat –a  will show all network connection like tcp and udp

Show both listening and non-listening (for TCP this means established connections) sockets

–at will display only tcp connections

–au  it will display only udp connections

-lt   it will show tcp listening connections

–lu   it will show udp listening connections

–s  it will Display summary statistics for each protocol

–st will display summary statistics for tcp protocal

-su  will display summary statistics for udp protocal

-p   Show the PID and name of the program to which each socket belongs

-pt shows the pid of tcp connections

Netstat   –ei it will show the all the interfaces

e refers to extended

I referes to interface

This command will give same output like ifconfig

Netstat   –tupan this command will show you all connections opended

If you want find any service you can use this command with grep

Netstat  -tupan | grep httpd

Or if you want to check any port number

Netstat –tupan | grep 80


Leave a Reply

Your email address will not be published. Required fields are marked *