The command netstat
This command, available on Unix and Windows, lists established connections by trying to replace IP addresses with DNS names and port numbers with their name. But there are several switches that can change its behavior:
- The switch "-n" disables the replacement of IP addresses and port numbers with a name (which greatly speeds up display).
- The switch "-a" requests to list all sockets without limiting itself to only connected sockets (so it includes both TCP sockets regardless of their state and UDP sockets)
- On Unix, there is also the switch "-p" to associate each socket with the corresponding Unix process (on Windows, you will have to use the graphical application " TCPView " to obtain the same level of information).
On Unix, the three switches can be combined, which gives:
The command can also be written as: