****************** ****
1. view the Windows system Port Number:
Netstat-abnov
1) view the process occupied by the port number 3030 in Windows
Step 1: netstat-Aon | findstr 3030
Result:
PID
TCP 0.0.0.0: 443 0.0.0.0: 0 listening 1796
TCP 0.0.0.0: 8443 0.0.0.0: 0 listening 1796
Step 2: tasklist | findstr 1796
Result:
Javaw.exe 1796 console 0 43,044 K
How to check which port number isProgramOccupied?
I,
1) Input netstat-ano in cmd.
2) if I check what occupies port 80, the corresponding process ID is 3600.
Enter tasklist to check which process is PID 3600 and which program is running.
3,
It will soon be seen that Tomcat 6 is using PID 3600, which occupies port 80.
In this case, you can use taskkill/PID 3600/T/F to quickly close the process.
Or
II.
Start -- run -- cmd enter the command prompt and enter netstat-ano. Then you can see all connected PIDs and find the program corresponding to the PID in the task manager. If no PID exists in the task manager, you can select "View"-"Select column" in the task manager. when starting the application, we find that the ports required by the system are occupied by other programs, how to know who owns the port we need is a headache for many people. The following describes a very simple method.
If we need to determine who occupies our port 9050
1. Windows Platform
Run the following command in the Windows command line window:
C: \> netstat-Aon | findstr "9050"
TCP 127.0.0.1: 9050 0.0.0.0: 0 listening 2016
As you can see, the port is occupied by a process with the process number 2016. Continue to execute the following command:
C: \> tasklist | findstr "2016"
Tor.exe 2016 console 0 16,064 K
It is clear that the TOR occupies your port.
In Linux:
Lsof-I: 80
******************* ***********
2. Check the TCP/UDP port number in Linux:
Netstat-tupln
3. in Linux, view the running process based on the Port:
Method 1: netstat-anp | grep 3030
Method 2: lsof-I: 22
4. view the port number for running the process name:
Method 1: netstat-anp | grep process name
4. Process Termination:
1) terminate the process according to the process Number:
Method 1: release resources immediately (recommended)
Kill-15 PID
Method 2: Do not release resources immediately (not recommended)
Kill-9 PID
V. View process information in Linux
PS-Aux
There are many commands for viewing processes. I just listed the most commonly used commands.
Netstat-TLN // view the service listening port
Netstat // view the process ID
PS-Aux // view process number
PS-Aux | more // view all
PS-Ef | grep MySQL // view the MySQL process
Kill-9 3306 // force kill process 3306
Vi. Firewall settings
Set firewall: Setup
View firewall settings: iptables-l