How to kill a process in Ubuntu 20.04LTS?

How To Kill A Process In Ubuntu

In this article, we will be discussing how to kill a process in Ubuntu.

When you launch an application, there are some processes that run in the background for that application. Sometimes, the application is not responsive, and to close that application, we need to kill that process. In Windows, we can kill a process using the Task Manager application. In Ubuntu, we can kill a process through terminal and GUI. Follow this article to know how to kill a process in Ubuntu.

1. Using GUI

We can kill a process using the System Monitor application. Click on the Show application icon in the bottom left corner.

kill-process-1

Open the Utility folder and click on the System Monitor application.

kill-process-2

Now, right-click on the process you want to kill and click on Kill to kill the process. You also have other options like stop, end, continue.

kill-process-3

2. Using Command Line(Terminal)

We can kill a process using the command line by using the Process ID(PID) of a process. Follow the steps below to know the PID and kill the process using the terminal.

Open a terminal window by pressing Ctrl+Alt+T. Execute the following command to know the PID of a process.

pidof <program_name>
pidof chrome
kill-process-4

Now, to kill a process, execute the following command:

sudo kill process_id
sudo kill 12477

In this example, the process id for chrome is 12477 as shown in the image above. There are different processes running for a single application.

kill-process-5

To kill multiple processes, provide all the PID’s pf the processes you want to kill by executing the following command:

sudo kill <process_id_1> <process_id_2> <process_id_3>
sudo kill 12378 12289 12258 12256
kill-process-6

To kill all processes at once using a single command, execute the following command:

sudo killall <program_name>
sudo killall chrome
kill-process-7

Conclusion

So, we discussed how to kill a process in Ubuntu. The terminal method is more preferred as you can kill multiple or all processes using a single line command, but if you are not familiar with the command line, you can use the GUI method too.