Using the taskkill command to end Windows processes
Linux provides many tools to manage system processes. You can use them to create, clone, and even destroy processes. Sometimes you may need to kill all processes by name in Linux. There are multiple ways to do this in Linux. You can use any of pkill, pgrep, pidof and killall functions. In this article we will look at them in detail.
Here are the different ways to kill process by name in linux
Sometimes when an application in Windows hangs, freezes and stops responding the only way to terminate it is to kill from the command-line.
The taskkill
command in Windows serves for terminating tasks by name or by process id (PID).
In this note i am showing how to find and kill a process by its name or by PID and how to identify a process by the listening port.
I am also showing how to troubleshoot “The process could not be terminated” and “Access denied” errors.
List all Windows processes and find the full name of a process to kill (case insensitive):
C:\> tasklist | findstr /I process_name
Kill the process by name:
C:\> taskkill /IM process_name.exe
Kill Process by PID
List all Windows processes and find the PID of a process to kill (case insensitive):
C:\> tasklist | findstr /I process_name
Kill the process by PID:
C:\> taskkill /PID process_id
Kill Process by Port
List all Windows processes listening on TCP and UDP ports and find the PID of a process running on a specific port:
C:\> netstat -ano | findstr : port
Find the name of a process by its PID:
C:\> tasklist /FI "pid eq process_id "
Kill the process by name or by PID:
C:\> taskkill /IM process_name.exe - or - C:\> taskkill /PID process_id
Troubleshooting
ERROR: The process with PID XXX could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).
C:\> taskkill /F /IM process_name.exe - or - C:\> taskkill /F /PID process_id
ERROR: The process with PID XXX could not be terminated.
Reason: Access is denied
- Home
- Partition Manager
- CMD Kill Process: How to Kill Process in Command Prompt
Why You Need to Use Windows PowerShell/CMD Kill Process
As you know, the operating system will create a process for the executable file when you start running an app. This process contains the program code and its current activity. In addition, you can find the Process Identifier (PID) assigned by Windows to identify each process.
Sometimes you have to kill a process if an app is not responding or behaves unexpectedly, system resources are much occupied, or other reasons. When it comes to killing a process, most people may open Task Manager
by pressing Ctrl + Shift + Esc
keys and then right-click the Process and select End task
.

How to Kill Process CMD/PowerShell in Windows 10/11
This part will show you how to kill process Windows command line/PowerShell. You can choose one according to your preference.
# 1. C MD Kill Process


taskkill /F /PID pid_number

taskkill /IM “process name” /F

taskkill /IM Process Name /IM Process Name /F

taskkill /PID PID /PID PID /F


# 2. PowerShell Kill Process
In addition, you can make Windows kill process command line via PowerShell. Here’s how to do that:

Stop-Process -Name “ProcessName” -Force
Stop-Process -ID PID -Force
About The Author
-

Start Task Manager.
Press the key, the key, and the key in consecutive order at the same time to open Task Manager. -

View the names of the running processes and identify the problematic process.
Click the Processes tab in Task Manager and find the name of the process that you want to kill.- Windows 8/8.1 users should click the Details tab.
- If a program that is currently running on your screen is frozen and you want to kill it, an easy way to find its name is to click the Applications tab (Processes tab in Windows 8/8.1), right click the window’s name, then click Go to process
( Go to details
in Windows 8/8.1). - If the Task Manager window does not display any tabs, double-click in the indicated space in the window to show them.
-

Open the Start menu.
Press the key. -

- If a User Account Control dialog appears, click on it.
-

Type taskkill /f /im
into Command Prompt. -

Space at least once after completing the previous step, type a quotation mark, type the name of the process you want to kill, then type another quotation mark to top it off.
-

Kill the process.
Press the key.- Command Prompt should display a message similar to SUCCESS: The process “example.exe” with PID 0000 has been terminated
.
- Command Prompt should display a message similar to SUCCESS: The process “example.exe” with PID 0000 has been terminated
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Thanks for submitting a tip for review!
Do not kill critical Windows processes
using this method. If you kill a Windows-reliant process using Command Prompt, you might cause system instability or crashes.

Описание команды kill
Посылает сигнал процессу. Обычно используется для «убийства» процесса (прерывание процесса).
Синтаксис
— это PID (числовой идентификатор) процесса или несколько PID процессов, если требуется послать сигнал сразу нескольким процессам.
По умолчанию команда шлет сигнал
(он также называется
и имеет числовое значение
).
Опции
или или
Задает сигнал, который будет послан процессу. может задаваться числом или названием.
или или
Вывести список всех сигналов.
Если задано значение то вывод зависит от того, чему равно заданное значение :
- числовой номер сигнала — в таком случае будет выведено название сигнала;
- название сигнала — в таком случае будет выведено числовое значение сигнала.
или
Вывести список сигналов в табличном виде. Выводится числовое значение и название каждого сигнала.
Примеры использования команды kill
Определить PID процесса
Так как команда принимает на вход PID (идентификатор) процесса, то необходимо сначала узнать PID процесса, которому требуется отправить сигнал. To do this, you can use the command ps
(instead of firefox
specify process name):
ps -ef | grep firefox 
List signals
Display a list of all available signals:
kill -L As a result, we get a list of signals and their numerical values:
$ kill -L
1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS
8 FPE 9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM
15 TERM 16 STKFLT 17 CHLD 18 CONT 19 STOP 20 TSTP 21 TTIN
22 TTOU 23 URG 24 XCPU 25 XFSZ 26 VTALRM 27 PROF 28 WINCH
29 POLL 30 PWR 31 SYS 
Send SIGTERM signal
Let’s send a signal
process with PID 3012:
kill 3012 Sending a KILL signal (process termination)
Let’s send a signal
process with PID 3121 to force the process to terminate:
kill -KILL 3121 Or you can use the numerical value of the signal:
kill -9 3121 Sending a signal to multiple processes
Send signal
multiple processes at once. To do this, you need to list their identifiers:
kill -9 2903 2977 3012 Sign in
to like
See also
TASKKILL
Command line format:
Description of command line options :
/P password
– The password for this user context. Asked if it is not set.
/FI filter
– Apply a filter to select a set of tasks. Permission to use “*”. Example, imagename eq acme*
/PID process
– ID of the process to terminate. Use TaskList to get the PID.
/IM image
– The name of the process image to terminate. The wildcard “*” can be used to specify all jobs or image names.
/T
– Termination of the specified process and all its child processes.
/ F
– Forced termination of the process.
/?
– Display help on usage.
1) The ‘*’ character for the /IM option is only applicable in conjunction with filters.
2) Termination of remote processes will always be forced (/F).
3) The “WINDOWTITLE” and “STATUS” filters are not taken into account when the computer is remote.
Examples of using TASKKILL.
taskkill /? > taskkill.txt
– issue help on using the command to the text file taskill.txt
TASKKILL /IM notepad.exe
– terminate the process whose executable image is notepad.exe
. If such
more than one process – then all will be completed.
taskkill /PID 1234 /T
– end process with ID 1234
and all its child processes ( /T ) . One team
you can kill multiple processes by setting their PID – taskkill /PID 1234 /PID 2345 /PID 800
. To define an identifier
processes use the command tasklist
:
notepad.exe 824 Console 1 3 916 KB
notepad.exe 3004 Console 1 18 812 KB
Where 824
and 3004
are process IDs PIDs
TASKKILL /F /FI “PID ge 2000” /FI “WINDOWTITLE eq Arc*”
– forcibly (/F) terminate the process whose ID is
greater than or equal to 2000
and
whose window title starts with text Arc
When terminating processes both locally and remotely, the result of executing the command TASKKILL
depends on user rights,
under the account context of which the command is being executed.
For use in a multi-user system configuration, such as a terminal server, instead of the TASKKILL command, it is more convenient and safer
use command TSKILL
, adapted to terminate processes in a specific Remote Desktop (RDP) user environment.
Full list of CMD Windows commands
or killall. Let’s see how to use these commands, find the PID of a process, and send a SIGKILL signal.
By process we mean a copy of the program running in the system. For example, if you have three calculator windows open (for example, gcalctool), this means that you have started three processes.
Find the PID of the hung process
Every process in Linux has its own process ID called PID. Before you can stop a process, you need to determine its PID. To do this, we will use the ps and grep commands. Command ps
is designed to display a list of active processes in the system and information about them. grep command
runs at the same time as ps (in a channel) and will search against the results of the ps command. You can list all processes by executing in the command line:
ps axu But, as a rule, the list is very large and finding the process that we want to “kill” is not so easy. This is where the grep command comes to the rescue. For example, to find information about a process named gcalctool, run the command:
ps axu | grep gcalctool $ ps axu | grep gcalctool
yuriy 25587 0.0 0.0 10636 884 pts/2 S+ 10:20 0:00 grep --color=auto gcalctool That is, we got the grep process itself, since we specified the word gcalctool as a parameter to the command, and grep found itself in the output of the command ps
.
If the gcalctool process is running, we get:
yuriy@yuriy-NIX:~$ ps axu | grep gcalctool
yuriy 25609 7.6 0.4 500840 17964 ? Sl 10:20 0:00 gcalctool
yuriy 25624 0.0 0.0 10640 884 pts/2 S+ 10:21 0:00 grep --color=auto gcalctool Here we are interested in the line: « yuriy 25609 7.6 0.4 500840 17964 ? Sl 10:20 0:00 gcalctool
“. The number 25609 is the ID (PID) of the gcalctool process.
There is another easier way to find out the PID of a process is the pidof command
, which takes the name of the process as a parameter and outputs its PID. An example of executing the pidof command:
$ pidof gcalctool
25609 “Kill” the process with the kill command
When the PID of a process is known, we can kill it with the kill command
. The kill command takes the PID of the process as a parameter. For example, let’s kill the process with the number 25609:
kill 25609 In general, the kill command is intended to send a signal to a process. By default, if we don’t specify which signal to send, the SIGTERM signal (from the word termination – termination) is sent. S IGTERM tells the process to terminate. Each signal has its own number. S IGTERM is number 15. A list of all signals (and their numbers) that the kill command can send can be displayed by running kill -l
. To send a SIGKILL signal (numbered 9) to process 25609, at the command line, run:
kill -9 25609 The SIGTERM signal may not stop the process (for example, when catching or blocking the signal), SIGKILL always kills the process, since it cannot be caught or ignored.
Kill processes with the killall command
killall command
in Linux is designed to “kill” all processes that have the same name. This is convenient because we don’t need to know the PID of the process. For example, we want to close all processes named gcalctool. Run in terminal:
killall gcalctool The killall command, like the kill command, sends a SIGTERM signal by default. To send another signal, you need to use the option -s
. For example:
killall -s 9 gcalctool Conclusion
Some processes cannot be stopped as a normal user. For example, if the process was launched as the root user or as another system user, then the kill and killall commands must be executed on behalf of the superuser, adding sudo (in Ubuntu):
sudo kill 123 Help on using any command can be obtained with the man command:
man ps
man grep
man pidof
man kill
man killall Manage Windows processes via CMD
The basis of the work of every system administrator is monitoring of operating systems
and ensuring that all processes are running normally – at least as expected. Careful monitoring of event logs
Helps you identify and track issues in applications, security, and critical services. Обнаружив или предполагая проблему, админ должен докопаться до ее причины и устранить. Точное определение причины проблемы предотвратит ее повторное появление.
About This Article
Thanks to all authors for creating a page that has been read 52,599 times.
Using pidof
Similarly, you can also use pidof
command to get the list of PIDs for a process name
$ pidof apache 6123 6230
You can pass this list to kill command to kill all processes by name.
$ kill -9 `pidof apache
` Bonus Read : How to Search a File in Linux
Using killall
You can also use killall command to kill all processes by name.
$ killall -9 apache
Hopefully, the above article will help you kill all processes by name in Linux.
Related posts:

Using pkill
pkill
command allows you to directly kill process by name. For example, here’s the command to kill all processes by name apache
$ sudo pkill apache
You may also use -f option to search the actual command used for running the process. For example, here’s the command to search and kill process with command /etc/apache/bin/apache
$ sudo pkill -f /etc/apache/bin/apache
Bonus Read : How to create tar.gz file in Linux
About This Article
Thanks to all authors for creating a page that has been read 23,525 times.
Управление приложениями, процессами и производительностью
Всякий раз, когда операционная система или пользователь запускает службу, приложение или команду, Microsoft Windows запускает один или более процессов для управления соответствующей программой. Несколько утилит командной строки
упростят вам мониторинг программ
и управление ими. К этим утилитам относятся:
Things You Should Know
- Run the tasklist command first to see which tasks are running.
- To kill a task, run taskkill /IM imagename
. - To end all tasks that aren’t responding, run taskkill /FI “STATUS eq NOT RESPONDING”
.
-

Open Command Prompt.
Click start
, type Command Prompt
into the search bar, and then click on “Command Prompt”
in the results.
- To start Command Prompt as administrator, right-click it, and select “Run as administrator”. You will need to do this to end any programs that are also running as administrator.
-

-

Review the list.
Review the task list to search for the program that you want to end. Look at the “Image Name” specifically, since you will need this information to kill the task.- You will probably have to scroll down to review all of the processes since they won’t fit all on one page.
-

Kill the task.
First, you need to type in taskkill
. Then, you have to specify that you are killing the task based on its image name, so put in a space, and then type in /IM
. After this, put in another space, and then type in the Image Name of the program that you want to end. For this example, notepad.exe will be the task that will be killed. Afterwards, press . This will kill the task.- For this example, the whole command would look like taskkill /IM notepad.exe
.
- For this example, the whole command would look like taskkill /IM notepad.exe
-

Type in tasklist
.
Just like the previous task, you need to type in tasklist to view the running programs and to retrieve the image name. -

Type in the regular taskkill command.
You would first type in the command like your normally would. For example, to forcefully kill notepad.exe, you would type in taskkill /IM notepad.exe
. -

Add /F
to the end of the command.
The “/F” argument tells taskkill that you want to forcefully end the process. Keep in mind that you have to add a space before adding this argument.
-

Type in taskkill
.
This is the beginning of the command. -

Type /FI "STATUS eq NOT RESPONDING"
.
This specifies that you want to kill all programs that are not responding. Remember that you need to add a space after taskkill
. -

Add /F
to the end.
Since non-responsive programs will not close on their own, they need to be forcefully closed. Then, press . This will end all non-responsive programs.- Remember to add the space before typing /F
.
- Remember to add the space before typing /F
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
- The taskkill command is not case sensitive
There are many other things that taskkill can do, but most people will not need to use them. You can view all arguments for the taskkill command
- here
.

Be careful with the command prompt. Although taskkill cannot really harm your computer, other commands can cause damage. You can always see what a command does by typing the first part, and then typing in



