"Netstat" is a network statistics tool, which can be used to view network connection, routing table and network interface information. You can use the following command to see if the port is open:
netstat -tuln | grep
Where `` is the port number to query. After running the above command, if the port is included in the output, it means that the port has been opened.
In this command, the "-tuln" option means: "-t" is used to display TCP connection, "-u" is used to display UDP connection, "-l" is used to display listening connection, and "-n" is used to display port number instead of service name.
Step 2 use the lsof command
"Lsof" is a tool for displaying and manipulating open files. It can also be used to see if a process is using the specified port. Use the following command to see if the port is open:
lsof -i:
Where `` is the port number to view. If the port is open, the process information related to the port will be displayed.
Step 3 use the "ss" command
Ss' is another powerful network tool for viewing information such as sockets, network interfaces and routing tables. Use the following command to see if the port is open:
ss-tunn | grep
Where `` is the port number to query. After running the above command, if the port is included in the output, it means that the port has been opened.
Step 4 use the nmap command
"Nmap" is a network scanning tool that can be used to detect open ports of remote hosts. You can use the following command to scan whether the port is open:
nmap -p
Where `` is the port number to be queried and``` is the IP address of the host to be queried. After running the above command, if the output display port is "open", it means that the port has been opened.