Monitoring and Killing Processes

Any process you own you can kill (this is not a moral judgment, just a fact of life in Unix and Linux).

If the machine itself is still responsive (but one or more windows perhaps aren't) you can try one of the Graphical Process Managers on our system.

Our linux machines have several GUI process managers, some applications (like netbeans and emacs) even have their own. Here are two. Either of these programs will let you view currently active process and also quit, end or kill currently active process that you own. In either one a right mouse click over a process in the list will bring up a menu and from that menu you can end or kill the selected process.

  • $$xfce4-taskmanager$$

    - if you look for it on the xfce menues you should find it at ``System`` ⇒ ``Process manager``

  • $$gnome-system-monitor$$

    - on the xfce menues it is at ``System`` ⇒ ``System Monitor``.

Command line xfce menu location kill example
Select any image above to see it larger.

An alternative to the GUI tools you can terminate a process from the command line. This is helpful if the machine is so bogged down that it is not launching the graphical tool or if if the keyboard and mouse are not working. In this last case you will need to log in from another (working) machine and kill the process that way. Go to any other working machine (Linux, Mac, or Windows), and ssh over to the frozen machine. Once there, follow the instruction from unixhelp on kill or try the steps below.

First find the process identifier (PID) of the thing you want to kill, type the command:

ps -xwu

The “u” lists your user name, it's nice to be sure it's your process.
The “w” lists in wide format, so you see more of the command in question.
The “x” list all processes owned by you, even those without a controlling terminal.

This will tell you the PID of your processes. You can then kill them with the kill command:


and if that doesn't work,


(a stronger, nasty form of “kill”.)

So, if “ps” shows the following:

grhopper  7302  0.0  0.0   2704   644 ?        S    Feb08   0:00 /usr/bin/dbus-launch --exit-with-session startxfce4
grhopper  7310  0.0  0.3  48268  9500 ?        S    Feb08   0:04 /usr/bin/xfce4-session
grhopper  7312  0.0  0.1   6688  3784 ?        S    Feb08   0:00 /usr/lib/libgconf2-4/gconfd-2 6
grhopper  7318  0.0  0.4  61604 12524 ?        Ss   Feb08   0:04 xfce-mcs-manager
grhopper  7319  0.0  0.3  17808 10716 ?        S    Feb08   0:10 xfwm4 --sm-client-id 117f001100100116181247600100137560010 --displa
grhopper  7320  0.0  0.9  65016 28084 ?        S    Feb08   1:04 xfdesktop --sm-client-id 117f001100100116181247700100137560002 --di
grhopper  7321  0.0  0.4  53816 14884 ?        S    Feb08   0:51 xfce4-panel --sm-client-id 117f001100100116181247600100137560001 --
grhopper  7329  0.0  0.8  61776 26168 ?        S    Feb08   1:01 /usr/lib/xfdesktop4/xfce4/panel-plugins/xfce4-menu-plugin socket_id
grhopper  7330  0.0  0.3  48460  9472 ?        S    Feb08   0:00 /usr/lib/xfce4-places-plugin/xfce4/panel-plugins/xfce4-places-plugi
grhopper  7331  0.0  0.3  49480  9600 ?        S    Feb08   0:01 /usr/lib/xfce4/panel-plugins/xfce4-mixer-plugin socket_id 18874408
grhopper  7332  0.0  0.2  15340  7572 ?        S    Feb08   0:02 /usr/lib/xfce4-systemload-plugin/xfce4/panel-plugins/xfce4-systemlo
grhopper  7333  0.0  0.1  13132  5048 ?        S    Feb08   0:00 /usr/lib/xfce4-netload-plugin/xfce4/panel-plugins/xfce4-netload-plu
grhopper  7334  0.0  0.3  56840 10600 ?        S    Feb08   0:01 /usr/lib/xfce4-screenshooter-plugin/xfce4/panel-plugins/xfce4-scree
grhopper  7335  0.0  0.2  17728  8908 ?        S    Feb08   0:00 /usr/lib/xfce4-mount-plugin/xfce4/panel-plugins/xfce4-mount-plugin
grhopper  7336  0.0  0.4  63204 13804 ?        S    Feb08   0:00 update-notifier --sm-config-prefix /update-notifier-FWS5Il/ --sm-cl
grhopper  7337  0.0  0.3  51224 10804 ?        S    Feb08   0:04 /usr/lib/xfce4-clipman-plugin/xfce4/panel-plugins/xfce4-clipman-plu
grhopper  7339  0.0  0.0   3000  1336 ?        S    Feb08   0:00 /usr/lib/gamin/gam_server
grhopper  7342  0.0  1.0 103880 33376 ?        Sl   Feb08   0:08 Thunar --sm-client-id 117f001100100116181247700100137560003 --daemo
grhopper 12226  0.0  0.0   4732  1992 pts/6    Ss+  Feb12   0:00 bash
grhopper 13566  0.0  1.5  57664 47180 ?        SN   Feb12   0:29 /usr/lib/opera/plugins/operapluginwrapper 20 23 /home/grhopper/.ope
grhopper 13567  0.0  0.0   2844   704 ?        S    Feb12   0:00 /usr/lib/opera/plugins/operaplugincleaner 29810
grhopper 18736  0.0  0.1   7844  3272 ?        Ss   09:32   0:00 xterm -vb -ls -fn 8x16 -geometry 80x28-4+0 -bg lightblue -fg black
grhopper 19494  0.0  0.8  81208 25368 ?        S    Feb08   0:16 /usr/bin/xfce4-terminal
grhopper 19496  0.0  0.0   5064  2356 pts/1    Ss   Feb08   0:00 bash
grhopper 20116  0.0  0.0   4856  2156 pts/3    Ss+  Feb09   0:00 bash
grhopper 20126  0.0  0.1   8832  3452 ?        S    Feb09   0:00 /usr/lib/gnome-vfs-2.0/gnome-vfs-daemon
grhopper 29286  0.0  0.0   2620   888 pts/1    R+   10:40   0:00 ps uxw
grhopper 29640  0.0  0.1   8828  5108 ?        Ss   Feb12   0:01 xterm -vb -ls -fn 8x16 -geometry 80x28-4+0 -bg lightblue -fg black
grhopper 29810  0.5  4.3 171076 134904 ?       S    Feb12   4:38 /usr/lib/opera/9.25-20071214.6/opera -style B3
grhopper 31491  0.0  0.0   4880  2184 pts/2    Ss+  Feb09   0:00 bash

The fields of most interest are the 2nd field “PID” and the last one that lists the process name.

In the above example I could nasty-kill opera (2nd line from the bottom) with:

kill -9 29810

With so many processes, it is hard to know which process to kill. Untill you get a feel for it, just keep trying them until you get the right one! (If you have something that is not saved, like an emacs editing session, you might want to try that last!)

It's a good idea to play with the “ps” command every once in a while to get used to its output. Sometimes you may have to kill a few things until you find the right one. If you accidentally kill the session that you are currently on (or the remote one that you are working from), login or just “ssh” over again and try a few more! Don't assume that because you have logged out or your session ended that the offending process has been terminated.

The processes with the word “session” in them are likely to be running your window session. If you kill those it will end your session and likely reset the window manager. However, it may not kill all your processes, so please be sure to check and kill any remaining processes after your session ends.

Once you kill the offending process everything else should return to normal. However, it's a good idea to save anything you are working on, log out, and log in again just to be safe. Also, I would appreciate you telling me if you had to do this: if we have a faulty program I need to fix it! So again, please let me know. Tell me as much as you can about what was going on when the load shot up or the the system froze so I can try to prevent it from happening again.

After you kill the process you may see a message like:

   XIO:  fatal IO error 32 (Broken pipe) on X server ":0.0"
        after 94 requests (43 known processed) with 0 events remaining.
        The connection was probably broken by a server shutdown or

This is OK: it is just the machine telling you that something was killed and it doesn't know why.

This page was started life in emacs 19.33 and psgml back when is was about Sun OS. Since then it has been changed quite a bit and most recently converted into wiki format.

Greg Priest-Dorman 2008/03/31 12:11