Home >Operation and Maintenance >Linux Operation and Maintenance >How to check if a certain port is open in Linux

How to check if a certain port is open in Linux

WBOY
WBOYOriginal
2022-03-18 11:40:2413760browse

How to check whether a port is open in Linux: 1. Use the lsof command, which can list the files opened by the system. The syntax is "lsof -i:port number"; 2. Use "netstat -aptn " command, this command can view all open port numbers.

How to check if a certain port is open in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How does Linux check whether a certain port is open?

First we open the Linux command interface to check the port. In order to obtain higher permissions, switch to root user login

The first method is to use the lsof -i:port number command line, taking 80 as an example,

How to check if a certain port is open in Linux

If there is no output, it means that the port number is not enabled. In order to facilitate testing, I detect an open port number here, and the information shown in the figure will be output

How to check if a certain port is open in Linux

The second method is to use the netstat -aptn command line to view All open port numbers,

How to check if a certain port is open in Linux

Related recommendations: "Linux Video Tutorial"

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

Statement:
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