netstat

What is netstat

netstat is a commandline tool used to display IP-based connections on a client including its current sessions, it’s source and destination IPs, and port numbers.

netstat usage

netstat basic usage is the command without any arguments, which displays a list of active connections.

In order to display both, listening and non-listening sockets:

netstat -a

In order no to resolve domain names, but always display IP addresses:

netstat -n

In order to add PID column to the table, an o option should be used:

netstat -ano

In order to display statistics:

netstat -s