Netstat: practical guide to total control of connections [Windows and Linux]

Do you know the Netstat command? If your answer is no, I’ll explain briefly what it is for. This particular command will give you the opportunity to know in depth the connections established on your computer.

I know very well that it is not yet very clear; specifically Netstat, will allow you to show all the connections, the open ports of your PC and you can check some specific information about the Ethernet ports, to give you an example.

I can assure you, that if you have network problems, with this command you can understand where to intervene, so now you understand how important it is to know how it works.

Today I will show you what are the most used Netstat commands and what they are for.

stat Windows

In this section I will show you all the commands you can use via Windows. Just start the command prompt, possibly with administrator permissions and type what I will show you later.

-a: view active connections

By typing in the command prompt on Windows Netstat -a, you will be shown all active TCP connections, the TCP connection with the listening state and the UDP ports that are being listened to.

To give you an example below you will find an image when I started the command on my PC.

-t: displays the status of the TCP ports

In this case, once the command is launched, what you will see will be the status of all TCP ports.

-r: display the routing table

By launching the command I showed you now, what you will see inside the command prompt is all the information on the routing table.

-p: display the program name and PID

Using this command you will be able to check all the connections used by a given protocol.

I remind you that in this case, you will also need to add the type of protocol you want to be shown during the launch of the command (it should be written immediately after -p).

-o: display only the PIDs

In this case you will be shown the process indicator called in the PID jargon that checks each connection.

Netstat Linux

I want to remind you that Netstat is fully functional even on Linux. In this case it is obvious that you will not have the command prompt, but you will have to use the terminal.

The terminologies I showed you to use netstat in Windows are the same ones you can use for Linux.

Other Netstat commands and how to find them

I have not written all the various commands available, but the ones I showed you are the ones you should know and use if you have any problem or want to find the source of the problem.

However, if you do not have enough, use the /?, then typing completely: netstat /?; you can have the list and descriptions of all the commands you can use.

In this way, you will have the entire glossary to be able to know precisely the command to type in the Windows prompt, or in the terminal if you use Linux.

Leave a Comment