How to force kill a process in GNU/Linux

The information in this post is based on Ubuntu 20.04. It may or may not be valid for other versions.

Every now and then you have a hanging process that just won’t quit for some reason. The last time it happened for me was with the VLC media player, but it has happened with other programs too.

Unfortunately (or fortunately?) it doesn’t happen often enough for me to actually remember what to do about it each time, so I decided to write this little guide.

First, you need to find the process ID (PID) of the process. If the process is from a command-line program you can usually search for its executable name, but if it’s a desktop program it may not always be obvious what the name of the executable is, so you may need to do a bit of research.

In my case it was vlc which was obvious enough, though.

To get the PID you need to type:

ps aux | grep vlc

Which will show you any running process with “vlc” in the name.

Then you need to run the kill -9 command with root privileges on the PID you found:

sudo kill -9 PID

(replace “PID” with the number found with the first command)

And that’s it 🙂