Home > Operation and Maintenance > Linux Operation and Maintenance > How to check whether a port is occupied in Linux

How to check whether a port is occupied in Linux

王林
Release: 2019-12-06 11:33:54
Original
3833 people have browsed it

How to check whether a port is occupied in Linux

netstatThis command is commonly used in network monitoring. Using this command, you can view the services currently monitored by the system and the services that have been established, as well as the corresponding ports, protocols and other information.

netstatAlthough there are many parameters, not many are commonly used, mainly the following parameters:

netstat -[atunlp]
Copy after login

Recommended related video tutorials: linux video tutorial

-a: all, means to list all connections, service monitoring, Socket information

-t: tcp, list the services of tcp protocol

-u: udp, list the services of the udp protocol

-n: port number, use the port number to display

-l: listening, list the current listening service

-p: program, list the PID of the service program

For example:

Check whether the port number 19090 is occupied, as follows:

netstat -tunlp |grep 19090
Copy after login

The result shows:

tcp 0 0 0.0.0.0:19090 0.0.0.0:* LISTEN 26596/java
Copy after login

Related Recommended article tutorials: linux tutorial

The above is the detailed content of How to check whether a port is occupied in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template