Linux Command – netstat

netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multiā€cast memberships.

netstat [address_family_options] [–tcp|-t] [–udp|-u] [–raw|-w] [–listening|-l] [–all|-a]

Netstat prints information about the Linux networking subsystem. The type of information printed is controlled by the first argument, as follows:
–route , -r Display the kernel routing tables.
–groups , -g Display multicast group membership information for IPv4 and IPv6.
–interfaces, -i Display a table of all network interfaces.
–masquerade , -M Display a list of masqueraded connections.
–statistics , -s Display summary statistics for each protocol.

–verbose , -v Tell the user what is going on by being verbose. Especially print some useful information about unconfigured address families.

–wide , -W Do not truncate IP addresses by using output as wide as needed. This is optional for now to not break existing scripts.

–numeric , -n Show numerical addresses instead of trying to determine symbolic host, port or user names.

–numeric-hosts shows numerical host addresses but does not affect the resolution of port or user names.

–numeric-ports shows numerical port numbers but does not affect the resolution of host or user names.

–numeric-users shows numerical user IDs but does not affect the resolution of host or port names.

-c, –continuous This will cause netstat to print the selected information every second continuously.

-e, –extend Display additional information. Use this option twice for maximum detail.

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

-l, –listening Show only listening sockets.

-a, –all Show both listening and non-listening sockets. With the –interfaces option, show interfaces that are not up.

-C Print routing information from the route cache.