Home Netstat command to troubleshoot network issues
Post
Cancel

Netstat command to troubleshoot network issues

The netstat is used for Network Monitoring and Troubleshooting. It stands for the Network Statistics. The netstat is a command-line network utility that displays:

  • network connections for tcp, udp
  • routing tables
  • a number of network interface
  • network protocol statistics

To identify no. of connection on a given port or IP.

Syntax: netstat -[OPTIONS]

1
2
3
4
5
6
7
    Input: netstat -putan | grep <PORT/IP>
    where,
        t = tcp
        u = udp
        n = numerical addr
        l = listening ports
        p = PID

To see all the sockets

Syntax: netstat -a

To see all the TCP ports

Syntax: netstat -at

To see all the TCP v6 ports

Syntax: netstat -6at

TO list all the UDP ports

Syntax: netstat -au

To list all the listening ports

Syntax: netstat -l

TO view the numerical address

Syntax: netstat -ln

To view the routing table

Syntax: netstat -r

To view the PID of the programme of connection

Syntax: netstat -p

To check the no of connection from a specific IP address.

Syntax: netstat -angrep

To get the list of all the interface

Syntax: netstat -i

Which port a process is using?

Syntax: netstat -apgrep

How to see statistics by protocol?

Syntax: netstat -s

This post is licensed under CC BY 4.0 by the author.