The method of detecting whether the Port is occupied in linux
The command netstat is commonly used in network monitoring. With this command, you can view the services currently monitored and established by the system, as well as the corresponding ports, protocols and other information.
Although there are many netstat parameters, they are not commonly used, mainly the following parameters:
Netstat-[atunlp]
-a: all, which lists all connections, service monitoring, and Socket data
-t: tcp, listing the services of the tcp protocol
-u: udp, which lists the services of the udp protocol
-n: port number, displayed with port number
-l: listening, which lists the current listening services
-p: program, listing the PID of the service program
For example:
Check whether the port number 19090 is occupied, as follows:
Netstat-tunlp | grep 19090
The results show that:
Tcp 0 0 0.0.0 0 19090 0.0.0 0 15 * LISTEN 26596/java
These are the details of how to check whether the port is occupied in linux. Please pay attention to other related articles for more information.