Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of detecting whether the Port is occupied in linux

Shulou Source: shulou.com Published: 2022-06-03 02:24:44 10月04日 Update

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.

Tags: Services monitoring ports parameters slogans commands frequently used information content that is articles aspects more programs systems results networks network monitoring data monitoring Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Docker Huawei Shulou Tech Info Linux