In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "Linux how to check whether the port is enabled". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "Linux how to check whether the port is enabled".
Method: 1, use the lsof command to check whether the port is enabled, this command is used to list all the files that have been opened by the system, when the parameter is set to "- I", you can list the processes that meet the conditions, and the syntax is "lsof-I: Port number"; 2, using the "netstat-aptn" command, the command can view all the open port numbers.
This article operating environment: linux7.3 system, Dell G3 computer.
How does Linux check to see if the port is enabled
The lsof command is used to view the file that your process starts, the process that opens the file, and the port that the process opens (TCP, UDP). Retrieve / recover deleted files. Is a very convenient system monitoring tool, because the lsof command requires access to core memory and various files, so it needs to be executed by root users.
In the linux environment, everything exists in the form of files, through which you can access not only regular data, but also network connections and hardware. Therefore, such as Transmission Control Protocol (TCP) and user Datagram Protocol (UDP) sockets, the system allocates a file descriptor to the application in the background, regardless of the nature of the file, the file descriptor provides a general interface for the interaction between the application and the underlying operating system. Because the descriptor list of the application's open files provides a lot of information about the application itself, being able to view this list through the lsof tool will be helpful for system monitoring and debugging.
Syntax:
Lsof (option)
Options:
-a lists the processes that exist to open the file
-c lists the files opened by the specified process
-g list the details of the GID process
-d lists the processes that occupy the file number
+ d list the files opened in the directory
+ D recursively lists the files opened in the directory
-n list the files that use NFS
-I list the processes that meet the criteria. (4, 6, protocol,: Port, @ ip)
The first method:
Using the lsof command
Lsof-I: Port number
Examples are as follows:
The second method:
Use the netstat-aptn command.
Thank you for your reading, the above is the content of "how to check whether the port is enabled by Linux". After the study of this article, I believe you have a deeper understanding of how to check whether the port is enabled by Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.