In fact, some system administrators and programmers prefer something like
this progression of signals:
kill − 15 —This command sends a SIGTERM, which is a clean
shutdown that flushes data that needs to be written to disk, cleans up
memory registers, and closes the PID.
kill − 1 —As mentioned above, this command sends a SIGHUP, which
cleans up and usually also causes the program to restart.
kill − 2 —This command sends a SIGINT, which is an interrupt from
the keyboard, the equivalent to sending Ctrl+C. For example, if you want
to stop a program that is running in the background as a daemon instead
of in the terminal foreground, this is a good way to do it.
kill − 11 —This command sends a SIGSEGV, which causes the
problem to experience a segmentation fault and close. It does not flush
data to disk, but it may create a core dump file that could be useful for
debugging and learning why the program is misbehaving (or behaving
exactly as you told it to behave and not as you intended it to behave).
kill − 9 —This command sends a SIGKILL, which should be used as
a last resort because it does not sync any data. Nothing is written to disk
—no logging, no debugging, nothing. You stop the PID (usually, but not
always), but you get nothing that helps you either save data that needed
to be written to disk or assists you in figuring out what happened.
As you become proficient at process control and job control, you will learn
the utility of a number of kill options. You can find a full list of signal
options in the kill man page.
USING KILLALL
The killall command allows you to kill a process by name, as in
killall gedit, which would kill any and all gedit processes that are
currently running. You can also kill all processes being run by a specific
user (assuming that you have authority to do so) with killall -u
username. See the killall man page for more options.
Using Priority Scheduling and Control
Two useful applications included with Ubuntu are the nice and renice
commands. They are covered in Chapter 12, “Command-Line Masterclass,
Part 2.” Along with nice, system administrators can also use the time
command to get an idea of how much time and what proportion of a system’s