Книга: Fedora™ Unleashed, 2008 edition

Using the kill Command to Control Processes

Using the kill Command to Control Processes

The kill command is a basic UNIX system command. You can communicate with a running process by entering a command into its interface, such as when you type into a text editor. But some processes (usually system processes rather than application processes) run without such an interface, and you need a way to communicate with them, too, so we use a system of signals. The kill system accomplishes that by sending a signal to a process, and you can use it to communicate with any process. The general format of the kill command is as follows:

# kill option PID

A number of signal options can be sent as words or numbers, but most are of interest only to programmers. One of the most common is this:

# kill PID

This tells the process with PID to stop; you supply the actual PID.

# kill -9 PID

is the signal for kill(9 is the number of the SIGKILL signal); use this combination when the plain kill shown previously does not work.

# kill -SIGHUP PID

is the signal to "hang up" — stop — and then clean up all associated processes as well. (Its number is -1.)

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 signal man page.

Оглавление книги


Генерация: 1.277. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз