In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to quickly find out who is occupying the computer port under Linux and Windows. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
First, a simple understanding of the "port"
The "port" can be regarded as the outlet for the computer to communicate with the outside world. An IP address can have 65536 (256 '256), the port is marked by the port number, the port number is only an integer, and the range is 0' 65 535 (0 '256' 256-1).
Recognize the port
The computer field is divided into the hardware field and the software field, in the hardware field, the port is also called the interface, such as the common USB interface, the network card interface and so on; in the software field, the port generally refers to the communication protocol port which faces the connection service and the connectionless service in the network, is a kind of abstract software structure, including some data structure and the basic input and output buffer.
In network technology, port has other meanings, one is the port in physical sense, such as hub, switch, router and other connecting devices, and the interface used to connect other network devices, such as RJ-45 port and Serial port; the other is logical port, which generally refers to the port in TCP/IP protocol, with a range of 065535 (256 ports 256-1).
Port classification
Ports can be divided into the following three categories according to port number:
Well-known ports (0,1023): they are tightly tied to some services. Usually the communication on these ports clearly indicates the protocol of a service.
Registration port (1 024 / 49 151): they are loosely tied to some services. That is to say, there are many services tied to these ports, but these ports are also used for many other purposes. For example, many systems start processing dynamic ports around 1024.
Dynamic / private ports (49 152 to 65 535): in theory, these ports should not be assigned to the server. In fact, machines usually assign dynamic ports from 1024. However, there are exceptions. The RPC port for SUN starts at 32768.
View system open ports
Often check the state changes of the open ports of the system, you can improve the security of the system in time and prevent your computer from being invaded. We can use the netstat command to check the port status of our system.
1. Open the Command prompt window and enter the netstat-a-n command.
two。 Press enter to see the port number and status of the numerically displayed TCP and UCP connections.
Shut down unnecessary ports
By default, the computer system will have some useless or unsafe ports open. In order to ensure the security of the system, you can selectively close some ports. Here we introduce shutting down unnecessary ports by shutting down useless services.
Take shutting down Remote Desktop Help Session Manager (Windows remote Assistance service) as an example, the specific steps are as follows:
1. Click the start button and execute the Control Panel command in the pop-up shortcut menu.
two。 Switch to the Big Icon view in the Control Panel window that opens, and double-click the Administrative tools icon.
3. Open the Administrative tools window and double-click the Service icon.
4. Switch to Standard view mode in the Services window that opens, and then locate and double-click the 360 antivirus full scan Service option.
5. Click the disable option in the dialog box that opens, and then click the OK button. (note: if you need to start the service, click the start button in the Service status bar in the dialog box. After starting the service, you can also click the "stop" button to shut down the service)
2. How to check who occupies a certain port under the Windows system
When developing, we often encounter the situation that the port is occupied. At this time, we need to find out the program of the occupied port, and then end it. This article introduces how to find the occupied port.
1. Open a command window (run as an administrator)
Start-- > run-- > cmd, or window+R key combination, call up the command window.
2. Find all the running ports
Enter the command:
Netstat-ano
This command lists the usage of all ports.
Let's look at the occupied port in the list, such as 1224, and find it first.
3. View the PID corresponding to the occupied port
Enter the command:
Netstat-aon | findstr "8081"
Enter to execute the command, and the last digit is PID, which is 9088.
4. View the process of the specified PID
Continue entering commands:
Tasklist | findstr "9088"
Enter to execute the command.
Check which process or program occupies port 8081, and the result is: node.exe.
End the process
Force (/ F parameter) to kill all processes with a pid of 9088, including child processes (/ T parameter):
Taskkill / T / F / PID 9088
Alternatively, we open the task manager, switch to the process tab, and check the process corresponding to 9088 in the PID column. If we do not see the PID column, as shown below:
Then we can end the process so that we can release the port for use.
3. How to check which process the port is occupied by under the Linux system?
1. Lsof-I: Port number
2. Netstat-tunlp | grep port number
You can see which process the specified port is occupied by.
Tools / raw materials
Linux,windows
Xshell
Methods / steps
1. [step 1] lsof-I
2. Lsof-I is used to display qualified processes, and lsof (list open files) is a tool that lists files opened by the current system. Execute the lsof-I command as the root user, as shown below:
1. [step 2] lsof-I: Port number
2.lsof-I: the port number, which is used to check the usage of a port, such as the usage of port 22, and lsof-i 22, as shown below.
1. [step 3] netstat-tunlp
2.netstat-tunlp is used to display the port and process of tcp,udp, as shown in the following figure
1. [step 4] netstat-tunlp | grep port number
2.netstat-tunlp | grep port number, which is used to view the process of specified port number, such as netstat-tunlp for port 22, as shown in the figure below.
Thank you for reading! This is the end of the article on "how to quickly find out who is occupying the computer port under Linux and Windows". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.