There are several ways to kill a process in Ubuntu/Linux, discover the quickest way to force kill unresponsive program in 3 quick actions.
This applies to any unresponsive application or process as well.
How to force kill unresponsive program?
- 1. Hit Ctrl + Alt + T to open up your Terminal OR Alt + F2 to run a command
- 2. Type
xkill
. Your mouse cursor will turn into a smallx
as shown
- 3. With your mouse, click on the unresponsive program
And Boom! Gone for good!
P.s. This could take more than 10 seconds depending on your typing/motor skills too :p
Going Further
If you’re that lazy dev who insists upon not wanting to first launch the terminal and then having to type xkill each time, good news! You can create a simple keyboard shortcut that invokes the xkill command each time permitting you to kill any process at will.
How to create a Keyboard shortcut?
- Open your Keyboard Settings (Found in the System Settings)
- Click on the “Custom Shortcuts” and then on the “+” button
- When the custom shortcut dialog appears, type
xkill
in the Name and Command textbox
- Your shortcut will be added but will be in the disabled state. Click on “disabled”. Doing so will result in a screen as shown below –
- At this point the system is waiting for you to enter any combination of keys to be used. For example, you could use “Ctrl + Shift + B” and then this combination will become your new shortcut to launch xkill.
What to do if OS itself is Unresponsive/frozen?
If your entire system is unresponsive, and you cannot even access the Terminal, here are excellent helpful resources…
- For Ubuntu 16 and above -> What to do when Ubuntu Crashes
- For Mac 10x and above-> Recover From a Frozen Mac
- For Windows 10 -> Fix Frozen Windows
Alternate ways to kill an application
Besides this, there are several other ways to kill a program too.
Using the System monitor
-
- Open the System monitor app
- Find the application that you need to force kill
- Right click on the app and select kill process
kill-processes-unresponsive-programs-in-ubuntu/
Using killall
If you know the name of the program that is not responding, you can use killall to kill all instances of that program. The syntax for killall is shown below –
// kill all instances of chrome killall chrome
Bonus: Kill Applications that use a lot of Resources
If you do not know which applications are using a lot of your resources, you could use the program top
to find out. Execute top
in your terminal. Doing so will give you a screen as shown below which lists the running processes
If you need to kill any process from the list, find out the PID of the process from the first column. Then you can press k followed by the PID of the process. Finally, press Enter twice to terminate the process!
References
-
- https://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/
- https://www.maketecheasier.com/kill-unresponsive-application-in-ubuntu/
- https://www.fosslinux.com/20109/7-best-ways-to-kill-unresponsive-programs-in-linux.htm
- https://vitux.com/4-ways-to-kill-unresponsive-applications-in-ubuntu/
- https://www.howtogeek.com/211153/how-to-kill-a-desktop-application-or-background-process-on-linux/
- https://opensource.com/article/18/5/how-kill-process-stop-program-linux