Trending October 2023 # How To Kill A Process With Linux # Suggested November 2023 # Top 11 Popular |

Trending October 2023 # How To Kill A Process With Linux # Suggested November 2023 # Top 11 Popular

You are reading the article How To Kill A Process With Linux updated in October 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested November 2023 How To Kill A Process With Linux


The term a kill means to end a process. For example, when you shut down or kill a computer process, the computer stops all running tasks and terminates all processes immediately without allowing any additional actions. To kill a process means to terminate it forcefully. When a process is killed, all the resources allocated are released, its execution is stopped immediately and, freeing up the resources it was using. A process is usually done when it’s stuck, unresponsive, or causing system instability, causing the system to slow down or crash.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

What is Process in Computing?

In computing, a process refers to a task or program actively running on a computer system.  The system assigns a specific process ID (PID) to each process. Sometimes a process may become inaccessible, causing other complications that can impact the system’s performance or consume excessive resources.

In such circumstances, it may be essential to terminate or kill it to stop the process from executing. Depending on the operating system and situation, there are multiple ways to kill a process, which involves abruptly terminating its execution. The operating system may end the process automatically; due to specific circumstances, the user or administrator may manually end the process.

Key Takeaways

Killing a process is aborting a computer program running on a system.

This may be necessary when a process is unresponsive, consuming too many resources, or causing other issues.

Different operating systems have other methods for killing processes, such as the “kill” command on Unix-based systems and the “Task Manager” on Windows systems.

It is essential to be cautious when killing a process and to save any necessary work.

Consulting with a system administrator or expert may be necessary to avoid potential consequences such as data loss or system instability.

In Linux, What Processes can you Kill?

A regular user cannot kill Processes in the “init” process group or session (such as system services).

Processes that another user owns unless you have root privileges.

You cannot kill some system processes required for the system’s stability and security.

What Happens if You Kill a Process?

When you kill a process in Linux, the kernel sends a signal to the process requesting it to terminate. The signal is usually the SIGTERM signal (signal 15), which asks the process to gracefully terminate and perform cleanup tasks before exiting. The process has a chance to handle the signal and take any necessary actions before shutting down.

SIGKILL: It is the ultimate way to kill a process. It kills a process abruptly and can result in a fatal error. SIGKILL always works when it comes to killing the process. But the operating system fails if SIGKILL does not stop a process.

SIGTERM: It is not as lethal as SIGKILL. You can say it is a gentler way to kill a process. Many times SIGTERM may get blocked or handled.

SIGHUP: Also known as signal hangup, it is a symbolic constant defined in the header file h. The signal sent to the process notifies to reload configuration files and also informs the process if the user’s session has lost connection or hangs up, and the process should be aborted.

Steps to Kill a Process

You can view the running processes in Linux using various commands. Here are some commonly used commands:

Step 1: View Running Linux Processes

This step identifies the process that consumes the most resources and needs to be shut down. So to see the lists of all currently running processes, you need to use this command.



This command will reveal the process ids and users; apart from that, it also shows the CPU power and memory they are consuming.

So as you can see, the command reveals all the process IDs running in the background. You can press k and type the process ID to kill the process from the top interface.

Step 2: Located the Process to Kill

So before killing the process, you need to find its location. You can find a process by its name or by the process ID.

Locate a process by using the ps command. The ps command is also used to display the process IDs like the top command. But it does not have a similar interface to the top. Instead, this command provides a complete list of running processes formatted based on the tags the user added.


“-aux” is the most common option to add:

-a, the command shows all user’s processes instead of only current users.

-u, this command gives you in-depth information regarding every process.

-x, this command shows you the processes under the control of daemons.

Here this picture shows you the execution of the –a command.

Step 3: Use to terminate the process

As we have told you, there are several ways to kill a process in Linux. Let’s see the commands for shutting down a process using process ID.





This command, by default, sends a SIGTERM message. You can use this command to kill a process by using its name.

Some use pkill commands:

-n, to kill the new process that is discovered.

-o, to kill the oldest process that is discovered.

-x, to kill the process that matches the pattern exactly.



You can kill single processes simultaneously with their process ID using the Kill command. It sends SIGTERM to signal the process to stop.

To specify a signal, you can use the –signal command.



This is a special command that you can use to close a specified server’s connection to clients. But this command will abort if a server has run multiple unwanted processes.


kill -9

If you are in the process of shutting down an unresponsive service, you send a SIGKILL command to the process. You need to run it similarly to the kill command.

How to Use the Kill Command? 1. kill [signal] PID

In this command, “signal” is an optional parameter specifying the signal type to send to the process, and “PID” is the process ID you want to terminate. When a signal is not specified, the default signal sent is SIGTERM, which requests the process to terminate gracefully.

To use the “kill” command, follow these steps:

Identify the process ID of the process that you want to terminate using the “ps” command or any other process monitoring tool. You can also use the “pgrep” command to find the PID of a process by its name.

Once you have identified the process ID, use the “kill” command to signal the process. For example, to terminate a process with PID 1234 using the default SIGTERM signal, you can use the following command:

2. kill 1234

If you want to send a different signal to the process, specify it using the “-s” option followed by the signal name or number. For example, to send the SIGKILL signal to process 1234, you can use the following command:

3. kill -s SIGKILL 1234

Using the SIGKILL signal will force the process to terminate immediately without any cleanup, potentially resulting in data loss or other issues. Therefore, you should only use it as a last resort.


Terminating a process should only be considered a last resort when all attempts to resolve the issue have been exhausted. It is important to approach it cautiously to mitigate any potential unforeseen consequences. Always save your work before killing a process, and only terminate processes that you know are safe to stop.


Q1. When do we need to use Kill command?

We need to use the kill command when a particular process cannot be shut down manually.

Q2. How many kill commands are there?

There are many kill commands in Linux, like Kill -9, Kill, xkill, pkill, killall, and many more.

Q3. How do you use the top command to kill a process?

If you need to kill a process in the top interface, then you need to type k and the processID to kill the process.

Recommended Articles

We hope that this EDUCBA information on “Kill Process” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

You're reading How To Kill A Process With Linux

Update the detailed information about How To Kill A Process With Linux on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!