web123456

cmd close occupied port command and tutorial detailed explanation

//Close the port occupancy command
eg:
1. netstat -nao | findstr “8080” query port 8080
2. taskkill /pid 3017 /F Close process with pid 3017
//Detailed explanation ↓
But often, you only need to check the usage of a certain port, which process (corresponding to PID) is occupied, or you also need to Kill it. If you are in Windows operating system, you can use the netstat command to query the PID, and then you can open the Task Manager to view the process name corresponding to the PID; if the PID is not displayed, the menu "View" select Column" can be selected; after we know the process, we can kill the process. Below I will briefly describe what I know about processing on Windows and Linux systems. (If we need to determine who occupied our 8080 port) 1. Windows Platform
Execute under the windows console window:
Query port 8080
netstat -nao | findstr “8080”

TCP 127.0.0.1:9010 0.0.0.0:0 LISTENING 3017
You see that the process with PID 3017 takes up port 8080. If you want to know its process name further, you can use the following command: tasklist | findstr "3017" If you want to kill this process, you can of course use the method described above to KILL it in the task manager, but if you like to be more efficient, then use the taskkill command. taskkill /pid 3017 /F Then this process will be destroyed