You are here

How to kill processes with GUIs

One of the things I hate about Windows is that there is no good way to kill frozen processes. Theoretically, you type Ctrl-Alt-Delete, wait for Task Manager to pop up, and kill the process. But in reality, the process doesn't always die immediately (it usually takes multiple tries and a very long time). GNU/Linux users don't have this problem. Here's how to end processes using the terminal, a few GUIs, and even a first person shooter.

Killing processes in the terminal

The terminal (also known as the command line) is the most powerful tool for virtually any job. So let's look at how to kill processes with it. First, open your favorite terminal program (konsole for KDE, gnome-terminal for Gnome, and xterm are some good ones). Then, type ps -A (notps -a). This gives you a listing of all the programs currently running and their PID. To kill a program, type kill PIDHERE, replacing PIDHERE with the PID of the program as shown by ps. See figure 1 for an example. Note that sometimes you will get error messages when trying to kill a program. If you do, you must kill the program as root (sudo kill PIDHERE or su and then kill PIDHERE depending on the operating system).

Figure 1: Killing Pidgin using ps and kill in xterm

Often, the searching through ps's output is like searching for a semi-colon in a 5MB source file. Luckily, if you know the name of the program, it's easy to find it. Instead of typing ps -a, type ps -A | grep NAMEHERE, replacing NAMEHERE with the string you want to find. For example, if I typed ps -A | grep fire, all the processes with the string fire in them would be listed. You can also add the -i flag to grep (so you'd type ps -A | grep -i fire) to make the search string case insensitive.

Killing processes with GUIs

Both KDE and Gnome provide their users with GUIs for killing processes. In KDE, run KSysGuard (many distributions also use Ctrl-Esc). Just click on the tab, "ProcessTable", select the item, and click "Kill". In Gnome, open System Monitor (aka Gnome System Monitor), select the "Processes" tab, select the item, and hit "End Process". If you can't kill the process, try running the KSysGuard or Gnome System Monitor as root (see previous paragraph for more).

If you just want to kill an inactive window without having to dig up a PID or running a bloated GUI, there's an option called xkill. Just open a terminal, and type xkill. Click on a window, and it will be killed (right-click to cancel). KDE users can also type Ctrl-Alt-Esc to bring up xkill.

A bonus: killing processes and having fun

If you really want to "kill" a process, then you need to try psDooM (figure 2). Download (make sure it isn't a patch, but a source or a binary) and install it, copy an IWAD (Freedoom has a few available) into wherever you installed psDooM (usually /usr/local/games/psdoom), and then run one of the executables located in the folder. Now, when you get mad at the world, all you have to do is open up a Microsoft product in WINE, and then shoot it.

Figure 2: Literally killing processes in psDooM

Conclusion

You now know how to kill a process with the terminal, kill a process with KSysGuard, Gnome System Monitor, or xkill, and even shoot a process! Next time a Microsoft user complains about his system freezing, all you have to do is grin and show him GNU/Linux.

type "pgrep firefox" will show you the PID of firefox. Typing "pkill firefox" will close all processes with name "firefox". Typing "pgrep -l firefox" will show you the PID and the process name "firefox"

i actually have nothing to technically add to the parent comment, but the editing of it brings up an interesting point: what are the editorial policies of fsm, specifically regarding user posts?

because i was subscribed to this thread i saw the original post before it was edited and approved by the editor (by way of an emailed "thread subscription update"). while i did not find the original language offensive, i did find the conveyed attitude appalling.

though the single removed word wasn't particularly offensive to me, why not edit out the word and show the edits (eg "ps -A | grep is [not as powerful]")? that would show the community what exactly was edited unlike the current ominous note ("Edited for language, Admin"). or remove the entire post, maybe notifying the original author by email if they have an account (so they can repost a more appropriate comment if so desired).

and what garners an edit? profanity? poor attitude?

just curious as i considered myself a member of a very similar community (based on a linux publication) until an editor removed his own inflammatory post and denied both the post and the removal. that's not an "open" community i want to be part of, so i left.

heck, will this post be removed because i dare question the editors? ;)

The post contained useful information, but showed poor attitude.
I found the original language offensive. The trouble is, that person wasn't logged in.
I made the decision that guarantee the spread of (relatively valuable) information, didn't sneakily change comment's contents (I hate that), and respected the poster.

To me, poor attitude is even indirectly call somebody "stupid" - especially if you don't even have an account.

Please note that since we receive a number of comments, we often need to decide quickly - or we would spend the best parts of our days discussing whether a word means "A" or "B" :-D

We very, very, very rarely delete comments (it only happened once, actually) and very occasionally we edit them.

Great article. You gotta love the doom thing. This really shows how creativity in the free software world can thrive, because this would never be included in a commercial product.

One honorable mention: if you're in top (e.g. to look which processes use a lot of memory/cpu) you can kill an application by hitting "k" and typing in the PID. See man top or press "?" whilst in top for more info.

Thanks for letting me now about pdDooM (not that i'll ever use it, i kinda like the stability of my system).

I accidentally ran firefox it was not responding so I knew I had to kill the process and I did it once through the system monitor, well the following day when it happened again I accidentially hit the "hide process" and now and every time I turn the computer I can not see firefox on the system monitor. How do I enable it so that it would show as running on the system monitor again.

Author information

/ˈændruː/ /mi:n/
(n): a Christian.
(n): a student.
(n): a technology enthusiast.
(n): a journalist for several online publications.

Andrew Min is a student, programmer, and journalist from New York City.

My main forte in the technology realm is journalism. I’ve written for a variety of magazines, both print and non-print, with a focus on open source software and the new web. I’ve also been interviewed on a long list of topics, ranging from politicians on Twitter to open source software and homeschooling.

I also have experience with a variety of programming languages (Bash, Batch, CSS, JavaScript, PHP, and (X)HTML) and content management systems (WordPress). I’ve been hired to design and administer several websites. In addition, I’ve been the lead programmer on several small coding projects.