How to stop an application or process from the CLI
Using the command line interface (CLI), a user can stop (or kill) an application or process. This can be done on Linux or Windows.
Access to the Linux or Windows command line interface.
First, you will need to know the process ID. Running processes can be listed using the following command:
Once you have obtained the process ID, you can request for the application or process to end by:
where “####” is the process ID. If you want to force the process to end, you can use:
kill -9 ####
where “####” again is the process ID. You can use ps again to see if the process has terminated.
tasklist | findstr processName
to find the process ID of the process you are trying to terminate. “processName” in the above command should be replaced by the name or part of the name of the process you are looking for. If you want a list of all processes, simply use:
without redirecting the output to the findstr command. A sample command with sample output is:
C:\Users\User>tasklist | findstr iexplore
iexplore.exe 4632 Console 1 28,112 K
iexplore.exe 4676 Console 1 92,356 K
Then, once you have obtained the process ID, you can terminate it with:
taskkill /pid ####
where “####” is the process ID of the application or process you wish to end.
for more information.
Sign up to receive insightful content.
How to script link navigation
How to Find the Uptime of a System