7 Ways to Kill Unresponsive Programs in Linux

Linux software is robust enough to work without causing problems, but sometimes even the best apps might hang. Rather than wait for them to crash, you can kill these unresponsive programs. In fact, there are so many ways to kill Linux programs that you might find you’re spoiled for choice!

If you’re experiencing problems with an application in Linux, here’s how to kill a program in Linux.

1. Kill a Linux Program by Clicking the «X»

You’ve probably already tried walking away and making a hot drink. If you returned to your PC to find that the app is still hanging, it’s had enough time to recover. An unresponsive app typically has grayed-out buttons, or options that don’t appear to work. You may also be unable to move the app window around the screen.

So, what is the solution?

Simply click the X button in the top corner (left or right, depending on your Linux operating system). This should stop the program dead in its tracks. You might see a dialog box, asking you to Wait or Force Quit to end it now.

If all goes to plan, some distros will prompt you to send an error report.

2. How to Kill a Program in Linux With System Monitor

The next option is to open your Linux operating system’s System Monitor utility.

To find this in Ubuntu:

  1. Open Show Applications
  2. Scroll to Utilities
  3. Select System Monitor

Your distro will no doubt differ, but System Monitor displays a list of running processes under the Processes tab.

Related: How to Manage Processes on Ubuntu Using System Monitor

MAKEUSEOF VIDEO OF THE DAY

To force kill a Linux process, simply select it and right-click. You then have three options, which you should try in this order:

  • Stop: This pauses the process, letting you continue it later. It won’t work in most cases.
  • End: The correct way to close a process, this will safely terminate the application, cleaning temporary files on the way.
  • Kill: This is the extreme option and should only be used if End Process fails.

It’s best to use these in order. However, if the application is one that hangs regularly, you might prefer to use a command that you know works.

3. Force Kill Linux Application Processes With «xkill»

Another option you can employ is xkill.

This is a force kill tool preinstalled in Ubuntu, but you can install it via the Terminal on other distributions if necessary. When called, xkill will enable you to close any desktop process. Install it with the following command:

sudo apt install xorg-xkill

Once this is done, run xkill by simply typing

xkill

Your mouse pointer will then display a cross (or a skull). Left-click on the offending application to close it.

4. Force Quit Linux Apps With the «kill» Command

Can’t close your unresponsive app with a desktop tool? The solution might be a tool that force quits Linux apps in the command line.

Several command line options are available to help you to close your app. Better still, these can be used either on your computer or by connecting over SSH from another device.

Related: How to Set Up SSH on Linux

The Linux kill command can be used here, but first requires a process ID. You can find this by running a command interrogating the application for its process ID:

ps aux | grep [process name]

The result will display the process ID. This can then be used as follows to stop the Linux process:

kill [process ID]

Note that if your Linux kill app command fails, you may need to append the command with sudo.

5. Use «pgrep» and «pkill» Linux Force Kill Commands

What if you don’t know, or cannot find, the process ID? This is where the pkill command comes in. Rather than a process ID, simply use pkill along with the process name:

pkill [process name]

Alternatively, you can use the pgrep command to find the process ID:

pgrep [process name]

…and following this, use pkill with the process ID.

pkill [process ID]

As with the kill command, this should close the Linux process within around 5 seconds.

6. Force Kill Linux Instances With «killall»

No luck with kill or pkill? It’s time to use the nuclear option: killall.

Fortunately, it isn’t as devastating as it might be. The killall command will end all instances of a specified program. So, rather than killing one Firefox (or other Linux browser) window, the following command will end them all:

killall firefox

All you need is the process name and the killall command (possibly with sudo if demanded by your setup).

killall [process name]

Naturally, you should only use this command when needed. It’s unsuitable for most unresponsive program situations.

7. Force-Kill a Process in Linux With a Keyboard Shortcut

Want to save time closing unresponsive software? The best option is to create a keyboard shortcut. This will give you the immediate option to close an app, but it requires xkill for this to work. Here’s how it works in Ubuntu:

  1. Open Settings > Keyboard Shortcuts
  2. Scroll to the bottom and click + to create a new shortcut
  3. In the Name and Command fields input «xkill»
  4. Click Shortcut to set a keyboard shortcut combination to call the command
  5. Click Add to finish

To use the shortcut when an app hangs, just use the keyboard shortcut. The mouse pointer will become an X, and you can click anywhere on the app you want to close.

Regularly Force Quitting Linux Applications? Upgrade Your Hardware

Are unresponsive applications regularly causing problems? You could probably benefit from making some changes to your Linux computer hardware.

Installing additional RAM is the number one way to give your computer more power and might be just the thing you need to keep those temperamental apps from becoming unresponsive in future.

Now You Know How to Kill a Program in Linux

So, the next time a Linux application or utility hangs and becomes unresponsive, all you need to do is apply one of these solutions:

  1. Click the X in the corner
  2. Use the System Monitor
  3. Use the xkill app
  4. Employ the kill command
  5. Close Linux apps with pkill
  6. Use killall to close software
  7. Create a keyboard shortcut to automate killing an app in Linux

If you find you’re regularly terminating unresponsive Linux apps, why not consider switching to a more lightweight Linux operating system?

14 Lightweight Linux Distributions to Give Your Old PC New Life

Need a lightweight operating system? These special Linux distros can run on older PCs, some with as little as 100MB of RAM.

Read Next

About The Author

Servicio técnico Teveo Tecno

Entradas recientes

Cómo reiniciar los Joy-Cons de Nintendo Switch

Cuando tus Joy-Cons empiezan a dar problemas de conexión, reiniciarlos es tu mejor opción. La…

2 años hace

¿Safari sigue fallando en el Mac? 5 formas de solucionarlo

Safari es el navegador preferido por casi todos los usuarios de Mac. Funciona bien y…

2 años hace

7 formas útiles de utilizar la aplicación de accesos directos en tu Mac

Si eres un usuario de Mac relativamente antiguo, puede que no te hayas dado cuenta…

2 años hace

¿Debes actualizarte a macOS Ventura? Así es como se decide

macOS Ventura está repleto de increíbles funciones y mejoras, como Stage Manager, Continuity Camera, Freeform…

2 años hace

6 formas de solucionar el error de SSD no reconocido en Windows 10

Las unidades de estado sólido (SSD) tienen enormes ventajas sobre los discos duros magnéticos tradicionales,…

2 años hace

7 maneras de arreglar las imágenes que no se cargan en Google Chrome

Aunque Google Chrome es uno de los navegadores web más populares, no está libre de…

2 años hace