How to check the status of a specified port using netstat?
To check the status of a specific port using the netstat command, you can utilize the following command format:
netstat -tuln | grep <port>
-t: indicates the display of TCP connections.
-u: indicates to display UDP connections.
-l: Show only listening connections.
– n: shows IP addresses and port numbers in numerical form.
Use the grep command to filter the results and only display lines that contain the specified port.
Please replace
For example, if you want to check the status of the SSH service with port number 22, you can use the following command:
netstat -tuln | grep 22
This command will list all TCP and UDP connections listening on port 22, along with their status.