view pid

linux version

First, view the process port number

ps -ef | grep {appname}

Second, kill the process

kill -9 {pid}

 

windows version

1. Check the port number according to the process 

 

First, enter "cmd.exe" in the "Run" box of the start menu to enter the command prompt window, first enter the "tasklist" command to list the list of processes running in the system, and put the "PID" corresponding to the process you want to check. Note down or copy.

 

It should be noted that the "PID" number of the same process image name is generally different each time it runs, so once the process restarts, the "PID" number will change, which requires re-checking. 

 

After writing down the PID number of the process, then use this PID number to display the port opened by the process. 

For example, we need to see that the process "QQ.exe" (the process ID number is: 1332 in the above figure) has opened those ports, and continue to type the "netstat -ano | findstr 1332" command under the current command, where "netstat The -ano" parameter means to display all active TCP connections and the TCP and UDP ports that the computer is listening on in digital form, and display the corresponding process ID PID number; "|findstr 1332" means to find the TCP connection with the process PID "1332" And the listening status of TCP and UDP ports (in practical applications, you need to replace the 1332 here with the PID number you just wrote down or copied). After pressing the "Enter" key, the port number opened by the process will be displayed.

 

 

2. Check the process according to the port number 

 

Enter the "netstat -ano" command in the command prompt window to list the current port list of the system. The function of this command has been mentioned above. 

 

The function of the -o parameter is mainly to display the process PID number corresponding to each port. Now write down or copy the process PID number corresponding to the port you want to check. Then continue to enter "tasklist /fi "PID eq 788"" at the command prompt (in practical applications, you need to replace the 788 with the PID number you copied or wrote down), this line of statement "/fi" The parameter indicates Filter in "tasklist", and "PID eq 788" is the specified filter condition. After pressing the "Enter" key, the process corresponding to the port will be displayed. It can be seen that the process corresponding to the PID number "788" is "svchost.exe". If the port you are checking is not associated with any process, the prompt message "No task with the specified standard is running" will be returned. . 

 

 

3. Corresponding procedures for the investigation and handling process

 

Enter and execute the "cmd" command in Start - Run, open the "Command Prompt" window, enter and execute the Netstat -abnov command, you can see the list of initiators or files of each process in the feedback information (if ESTABLISHED is displayed under the State column if it is on a remote call), there is a PID number to the right of them

 

 

Fourth, kill a process

 

If you want to close a process, you can write down the PID number of the process, enter "taskkill /pid 2400" in the command prompt (2400 is the PID number), you can close the process with PID number 2400, if you want to force close the process process, just add a "/f" parameter after this command. 

 

Or use ntsd -cq -p pid (in practical applications, pid should be replaced with the actual pid number)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326447635&siteId=291194637