From 75a4a592e5ccda30715f93563d741b83e0dcf39e Mon Sep 17 00:00:00 2001 From: Patrick J Volkerding Date: Mon, 25 Apr 2011 13:37:00 +0000 Subject: Slackware 13.37 Mon Apr 25 13:37:00 UTC 2011 Slackware 13.37 x86_64 stable is released! Thanks to everyone who pitched in on this release: the Slackware team, the folks producing upstream code, and linuxquestions.org for providing a great forum for collaboration and testing. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. As always, thanks to the Slackware community for testing, suggestions, and feedback. :-) Have fun! --- slackbook/html/process-control-kill.html | 182 +++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 slackbook/html/process-control-kill.html (limited to 'slackbook/html/process-control-kill.html') diff --git a/slackbook/html/process-control-kill.html b/slackbook/html/process-control-kill.html new file mode 100644 index 000000000..322926512 --- /dev/null +++ b/slackbook/html/process-control-kill.html @@ -0,0 +1,182 @@ + + + + +kill + + + + + + + + + + + +
+

11.4 kill

+ +

On occasion, programs misbehave and you'll need to put them back in line. The program +for this kind of administration is called kill(1), and it can be +used for manipulating processes in several ways. The most obvious use of kill is to kill off a process. You'll need to do this if a program +has run away and is using up lots of system resources, or if you're just sick of it +running.

+ +

In order to kill off a process, you'll need to know its PID or its name. To get the +PID, use the ps command as was discussed in the last section. +For example, to kill off process 4747, you'd issue the following:

+ + + + + +
+
+% kill 4747
+
+
+ +

Note that you'll have to be the owner of the process in order to kill it. This is a +security feature. If you were allowed to kill off processes started by other users, it +would be possible to do all sorts of malicious things. Of course, root can kill off any process on the system.

+ +

There's another variety of the kill command called killall(1). This program does exactly what it says: it kills all the +running processes that have a certain name. If you wanted to kill off all the running vim processes, you could type the following command:

+ + + + + +
+
+% killall vim
+
+
+ +

Any and all vim processes you have running will die off. +Doing this as root would kill off all the vim processes running for all users. This brings up an interesting +way to kick everyone (including yourself) off the system:

+ + + + + +
+
+# killall bash
+
+
+ +

Sometimes a regular kill doesn't get the job done. Certain processes will not die with +a kill. You'll need to use a more potent form. If that pesky PID 4747 wasn't responding +to your kill request, you could do the following:

+ + + + + +
+
+% kill -9 4747
+
+
+ +

That will almost certainly cause process 4747 to die. You can do the same thing with +killall. What this is doing is sending a different signal to the +process. A regular kill sends a SIGTERM (terminate) signal to the process, which tells it to finish +what it's doing, clean up, and exit. kill -9 sends a SIGKILL (kill) signal to the process, which essentially drops it. +The process is not allowed to clean-up, and sometimes bad things like data corruption +could occur by killing something with a SIGKILL. There's a +whole list of signals at your disposal. You can get a listing of signals by typing the +following:

+ + + + + +
+
+% kill -l
+  1) SIGHUP     2) SIGINT    3) SIGQUIT   4) SIGILL
+  5) SIGTRAP    6) SIGABRT   7) SIGBUS    8) SIGFPE
+  9) SIGKILL   10) SIGUSR1  11) SIGSEGV  12) SIGUSR2
+ 13) SIGPIPE   14) SIGALRM  15) SIGTERM  17) SIGCHLD
+ 18) SIGCONT   19) SIGSTOP  20) SIGTSTP  21) SIGTTIN
+ 22) SIGTTOU   23) SIGURG   24) SIGXCPU  25) SIGXFSZ
+ 26) SIGVTALRM 27) SIGPROF  28) SIGWINCH 29) SIGIO
+ 30) SIGPWR
+
+
+ +

The number must be used for kill, while the name minus the +leading “SIG” can be used with killall. Here's +another example:

+ + + + + +
+
+% killall -KILL vim
+
+
+ +

A final use of kill is to restart a process. Sending a SIGHUP will cause most processes to re-read their configuration +files. This is especially helpful for telling system processes to re-read their config +files after editing.

+
+ + + + + -- cgit v1.2.3