kill
This subchapter looks at kill, a Unix (and Linux) command.
kill is used to send signals to a process, most often to stop processes.
kill is a builtin command in csh. There is also an external utility with the same name and functionality.
which processes can be killed
An ordinary user can only kill his or her own processes.
A system administrator running as root (including using sudo) can use kill on any process on the entire system.
frozen process
Sometimes a process (particularly web browsers) will freeze up. The kill command can be used to remove the frozen program from the system.
If a user finds their display locked up because of a frozen program, he or she can login to another computer, then login to the original system using rlogin, and then use the kill command to stop the offending process using the specific process ID.
killall
killall is a related command. killall program_name will stop all processes with the program name, so the more specific kill with a specific process ID is usually used first.
process isolation
Unix does a very good job of keeping processes isolated from each other, so that no rogue process can attack or damage any other process.
Unlike Windows, a frozen or crashed program on UNIX or Linux shouldnt be able to bring the entire operating system to a halt.
Most Unix vendors carefully test their own system software and most of the system software has been running and tested for decades, so those programs rarely cause problems.
Most bugs occur in third party software and in custom software developed for a particular installation.
remove background process or job
The most common use of kill is simply to remove a process or job. This is done by naming the PID of the process (whcih is usually obtained with ps).
$ kill PID
This works because the default signal is SIGTERM (terminate the process).
discover signals
You will find a chart of signals with the common signals for Linux, Mac OS X, and Solaris.
You can also discover the list for your system by running kill with the -l (lower case L) option.
$ kill -l
You can determine a specific signal with the -l option and a signal number.
$ kill -l 3
QUIT
$
Some operating systems give the entire signal name with the SIG prefix (such as SIGQUIT) and some give just the signal name (such as SIGQUIT).
testing
You can test the capabilities of your programs and scripts under abnormal coonditions by using kill to send a specific signal.
$ kill -s SIGNAME PID
The signal name (SIGNAME) can be the signal number or the signal name. The signal name can be either the signal name with or without the SIG prefix.
You may also simply enter the signal number or signal name (with or without the SIG prefix) as an option.
$ kill -6 PID
$ kill -SIGIOT PID
$ kill -IOT PID
other
On November 8, 2010, Ramesh Natarajan named this the number 26 most frequently used Unix/Linux command at this web page 50 Most Frequently Used UNIX / Linux Commands (With Examples).
comments, suggestions, corrections, criticisms
free music player coding example
Coding example: I am making heavily documented and explained open source code for a method to play music for free almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).
View music player in action: www.musicinpublic.com/.
Create your own copy from the original source code/ (presented for learning programming).
This section is under the category of owning cirticism.
In response to a posting about my article collecting social media, Moderator +Andrew Smith (Technology addict, Web Developer, API guru, futsal and football wannabe, and all round nice guy!, Swordfox Design, arrowtown, new zealand) of the Google+ community Web Developers, Web Designers, Web Coding claims Quite frankly this is self promotion, and your site is not of great quality. I can see how +Joost SchuurÊ would think this of not high enough a standard.
Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.
Names and logos of various OSs are trademarks of their respective owners.