If you are using KDE, there is a shortcut for killing a blocked X process. There is a very easily identifiable icon on the desktop, reproduced here:
This icon activates the command xkill which you can run from a terminal. When you click on this icon (or start the program from your terminal), the mouse cursor changes. You then left-click on the window corresponding to the process you want to kill.
These two commands are used to send signals to processes. The command kill requires a process number as an argument, while killall requires a command name.
The two commands can optionally receive a signal number as an argument. By default, they both send the signal 15 (TERM) to the relevant process(es). For example, if you want to kill the process with PID 785, you enter the command:
$ kill 785 |
If you want to send it signal 9, you enter:
$ kill -9 785 |
Suppose that you want to kill a process for which you know the command name. Instead of finding the process number using ps, you can kill the process directly:
$ killall -9 netscape |
Whatever happens, you will only kill your own processes (unless you are root), so don't worry about the "neighbor's" processes with the same name, they will not be affected.
top is a program all in one: it simultaneously fulfills the functions of ps and kill. It is a console mode program, so you start it from a terminal, like it is shown in figure 13-2.
The program is entirely keyboard controlled. You can access help by pressing h. Here are some of the commands you can use.
k: this command is used to send a signal to a process. top will then ask you for the process PID followed by the number of the signal to be sent (15 by default);
M: this command is used to sort processes by the amount of memory they take up (field %MEM);
P: this command is used to sort processes by the CPU time they take up (field %CPU; this is the default sort method);
u: this command is used to display a given user's processes, top will ask you which one. You need to enter the user's name, not his UID. If you do not enter any name, all processes will be displayed;
i: this command acts as a toggle; by default, all processes, even sleeping ones, are displayed; this command ensures that only processes currently running are displayed (processes whose STAT field states R, Running) and not the others. Using this command again takes you back to the previous situation.