Home >Operation and Maintenance >Linux Operation and Maintenance >How to test whether the port is accessible in Linux
Method: 1. Use the telnet command to test, the syntax is "telnet ip port"; 2. Use ssh to test, the syntax is "ssh -v -p port username@ip"; 3. Use wget to test, the syntax is "wget ip:port".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to test whether the port is accessible in Linux
Start a web server and provide the port.
[wyq@localhost ~]$ python -m SimpleHTTPServer 8080 Serving HTTP on 0.0.0.0 port 8080 ...
Use other web servers to provide it The same goes for the port. Since python is more convenient, I will use it here
1. Use telnet to determine
Telnet is a standard Windows service and can be used directly; if it is a Linux machine, you need to install telnet.
Usage: telnet ip port
1) First use telnet to connect to the non-existent port
2) Then connect to the existing port
2. Use ssh to determine
Ssh is the standard configuration of Linux and is the most commonly used. Can it be used to determine the port?
Usage: ssh -v -p port username@ip
-v debug mode (log will be printed).
-p specified port
username Feel free to
1) Connect to a non-existing port
2) Connect to an existing port
3. Use wget to determine
wget is a download tool under Linux and needs to be installed first.
Usage: wget ip:port
1) Connect to a non-existent port
2) Connect to the existing port
4. Use the port scanning tool
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to test whether the port is accessible in Linux. For more information, please follow other related articles on the PHP Chinese website!