Kill Runaway Linux Processes

Last modified: 
Tuesday, April 21st, 2015
Topics: 
sysadminLinux

Overview

This is a brief explanation of how to find and kill processes in Linux using Thunderbird as an example.

Example Problem

Thunderbird has locked up and refuses to time. Force quitting the application using the Force Quit menu applet in Ubuntu (or whatever) appears to close program, but when you attempt to relaunch Thunderbird you are told it is already running. Somewhere you have a runaway process.

Get Your Numeric User Id

id
#

This will return a string containing all your user and group information. You are looking for the number from this part:

uid=1010({your-username})

It should be at the very beginning.

List the Processes You are Running

ps -u $(whoami) -f

This will probably return a large unwieldy list. It might be more manageable if you pipe it to

less

or even narrow the results with

grep

.

Make Output More Manageable With Less

ps -u $(whoami) -f | less

Narrow it Down With Grep

Since in this case we know the binary's name involves the word thunderbird, we'll just grep for that.

ps -u $(whoami) -f | grep thunderbird

This will return a result something like this:

username    3404     1  1 10:48 ?        00:00:32 /usr/lib/thunderbird-3.1.12/thunderbird-bin
username    3681  3367  0 11:22 pts/2    00:00:00 grep --color=auto thunderbird
#

The second column is the pid, which is the number we want to pass to kill.

Kill the Process

kill 3404

Note that the pid won't always be 3404. 3404 is just what it happened to be in the case of this example. It nearly always be a different number each time.

In our example there are two processes returned: 3404 and 3681. We're not worried about 3681 because that's just the grep command we ran to filter our results. There's no need to kill that, it's already done.


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.