Miklix

How to Force Kill a Process in GNU/Linux

Published: October 29, 2020 at 5:14:46 PM UTC

This article explains how to identify a hanging process and forcefully killing it off in Ubuntu.


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 :-)

Share on BlueskyShare on FacebookShare on LinkedInShare on TumblrShare on XShare on LinkedInPin on Pinterest

Mikkel Bang Christensen

About the Author

Mikkel Bang Christensen
Mikkel is the creator and owner of miklix.com. He has over 20 years experience as a professional computer programmer/software developer and is currently employed full-time for a large European IT corporation. When not blogging, he spends his spare time on a vast array of interests, hobbies, and activities, which may to some extent be reflected in the variety of topics covered on this website.