Pages

Thursday, April 7, 2016

Netstat Command Examples

Netstat Command Examples

List All Ports (both listening and non listening ports)
# netstat -a | more

List all tcp ports
# netstat -at

List all udp ports
# netstat -au

List Sockets which are in Listening State
# netstat -l

List only listening TCP Ports
# netstat -lt

List only listening UDP Ports
# netstat -lu

List only the listening UNIX Ports
# netstat -lx

Show the statistics for each protocol
# netstat -s

Show statistics for TCP (or) UDP ports
# netstat -st
# netstat -su

Display PID and program names in netstat output
# netstat -pt

Print netstat information continuously
# netstat -c

Find the non supportive Address families in your system
# netstat --verbose
At the end, you will have something like this.
netstat: no support for `AF IPX' on this system.
netstat: no support for `AF AX25' on this system.
netstat: no support for `AF X25' on this system.

Display the kernel routing information
# netstat -r

Find out on which port a program is running
# netstat -ap | grep ssh

Find out which process is using a particular port:
# netstat -an | grep ':80'

Show the list of network interfaces
# netstat -i

Display extended information on the interfaces (similar to ifconfig) using netstat
# netstat -ie

No comments:

Post a Comment