Ubuntu/Linux – Force Kill unresponsive program in less than 10 seconds

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.

Force kill unresponsive program

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 small x as shown
    xkill linux
  • 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?

  1. Open your Keyboard Settings (Found in the System Settings)
  2. Click on the “Custom Shortcuts” and then on the “+” button
    Custom keyboard shortcut ubuntu
  3. When the custom shortcut dialog appears, type xkill in the Name and Command textbox
    custom keyboard shortcut command
  4. 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 –
    create keyboard shortcut step4
  5. 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…


Alternate ways to kill an application

Besides this, there are several other ways to kill a program too.

Using the System monitor

    1. Open the System monitor app
    2. Find the application that you need to force kill
    3. Right click on the app and select kill process
      ubuntu system monitor

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
top program
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