Linux and Windows view the process ID that occupies the port and kills the process

Source: Internet
Author: User

Sometimes the Tomcat port is occupied, the process ID needs to be detected and the process is killed.

1. Find the process ID that occupies the port (Windows and Linux as 8005 can also be quoted)

6904 is the process ID that occupies the port. In order to verify that the re-query port is 8009:

2.windows Kill Process:

To view the Taskkill help command:

C:\>taskkill/?TASKKILL [/S System [/u username [/P [Password]] { [/FI filter] [/pid ProcessID |/im imagename]} [/T] [/F] Description: Use this tool to terminate a task by Process ID (PID) or image name. Parameter list:/The S system specifies the remote system to connect to. /U [domain\]user Specifies the user context in which the command should be executed. /P [Password] Specifies the password for the provided user context.    If omitted, prompt for input. /FI Filter applies a filter to select a group of tasks. Allowed to use"*"。 For example, image name EQ acme*/pid ProcessID Specifies the PID of the process to be terminated.    Use TaskList to obtain PID. /im imagename Specifies the image name of the process to be terminated. Wildcard characters'*'can be used to specify all task or image names. /T terminates the specified process and the child processes that are enabled by it. /F Specifies that the process be forced to terminate. /?displays the help message. Filter: Valid value for Filter name valid operator-----------   ---------------           -------------------------STATUS eq, ne RUNNING|Not responding|UNKNOWN IMAGENAME eq, ne image name pid eq, NE, GT, lt, GE, le PID value SESSION    EQ, NE, GT, lt, GE, le session number.                                            CPUTime eq, NE, GT, lt, GE, le CPU time, formatted as HH:MM:SS. HH-when, MM-Min, SS-seconds memusage eq, NE, GT, lt, ge, le memory usage, KB USERNAME eq, NE user name, format [domain\ ]user MODULES eq, ne DLL name Services eq, NE service name WindowTitle E Q, NE window caption Description----1/IM switch to use wildcard characters only if the filter is applied'*'. 2The remote process always has to force (/F) termination. 3Not supported when specifying a remote machine"WindowTitle"And"STATUS"filter. Example: TASKKILL/IM notepad.exe TASKKILL/pid1230/pid1241/pid1253/T TASKKILL/f/im cmd.exe/T TASKKILL/f/fi"PID GE"/fi"windowtitle NE untitle*"TASKKILL/f/fi"USERNAME eq NT authority\system"/IM notepad.exe TASKKILL/S system/u Domain\username/fi"USERNAME NE nt*"/IM *TASKKILL/S system/u username/p password/fi"IMAGENAME eq note*"

Kill the above PID 6904 process:

Re-query the 8009-port verification process for dead: (Discovery Port not occupied)

3.linux kill Process: (Kill command)

Kill the above PID command for

Linux and Windows view the process ID that occupies the port and kills the process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.