9.4 Determining the Connection State

You can list all the actual TCP and UDP connections using the netstat command with the — a parameter.

$ netstat -an

Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp 0 0 194.149.105.18.22 194.149.103.204.24695 TIME_WAIT
tcp 0 0 194.149.105.18.3099 194.108.145.128.25 SYN_SENT
tcp 0 34472 194.149.105.18.3079 195.47.32.245.25 ESTABLISHED
tcp 0 0 *.22 *.* LISTEN
tcp 0 0 *.25 *.* LISTEN
tcp 0 0 *.53 *.* LISTEN
udp 0 0 *.53 *.*
udp 0 0 127.0.0.1.53 *.*

Note

If the switch — n is used, it means that the IP addresses will not be replaced with DNS names by reverse transltion.

The first two lines are the list header. The columns have the following meanings: ...

Get Understanding TCP/IP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.