How to check whether a port is occupied in Linux

青灯夜游
Release: 2022-04-14 19:12:56
Original
18752 people have browsed it

In Linux, you can use the netstat command to check whether the port is occupied. Method: 1. Log in to the system, right-click on a blank space on the desktop, and select "Open Terminal"; 2. In the terminal, execute the "netstat -anp | grep port number" command to view the output results. If "LISTEN" appears after the port, then Occupied.

How to check whether a port is occupied in Linux

The operating environment of this tutorial: CentOS 7 system, Dell G3 computer.

In Linux, you can use the netstat command to check whether the port is occupied.

Linux netstat command is used to display network status.

Using the netstat command allows you to know the network status of the entire Linux system.

Specific method:

1. Log in to the system, right-click on a blank space on the desktop and select "Open Terminal"

How to check whether a port is occupied in Linux

2. Terminal execution command: netstat -anp |grep port number

Take port 3306
as an example, execute the following command

netstat -anp |grep 3306
Copy after login

The usage of port 3306
will be displayed. When LISTEN appears behind the port, it means the port is occupied.

How to check whether a port is occupied in Linux

Extended knowledge:

If you want to view all currently used ports, you can use the following command:

netstat   -nultp
Copy after login

How to check whether a port is occupied in Linux

It can be seen from the picture that port 82 is not occupied.

Related recommendations: "Linux Video 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!