38.12 Killing All Your ProcessesOn many UNIX systems, kill ( 38.10 ) interprets the special "process ID" -1 as a command to signal all your processes (all processes with your user ID), except for the process sending the signal. So, for example, the command:
%
will terminate all your processes.
[5]
To see if your system supports this feature, type
You can use this to prevent
background jobs from continuing after you logout; just stick
This command is also useful in desperate situations. If processes are spawning out of control, or if your terminal is locked, you can log in from another terminal and kill everything, without having to dig through ps ( 38.5 ) to find the right process. [The zap ( 38.13 ) script searches process lists and kills processes automatically. - JP ] The special -1 process ID is defined differently for the superuser; if you're root, it means "all processes except system processes." If you can't use the -1 process ID, and you use the Bourne shell or another shell without job control, you can use a 0 (zero) process ID. That sends the signal to all members of the process group (that is, processes resulting from the current login). A 0 doesn't work on shells, like the C shell, that have job control ( 12.1 ) . - , , |
|