From LQWiki
Jump to: navigation, search

Killing a process means (1) sending it a signal with the kill command, or using the kill system call within a program, and especially (2) sending it specifically the KILL signal, forcing it to quit immediately.

It's always best to quit an application properly, such as selecting Quit from a menu. Ctrl-C or Ctrl-D will usually quit an application in a terminal, and File-Quit or closing the window will do the same in X. Using the command 'kill -TERM pid' (TERM is default, and so not strictly needed) will tell the given process to terminate.

The application can refuse all of these (but it should have a very good reason if it chooses to do so), in which case you can use 'kill -KILL pid' (or -9) to forcefully terminate it. The process will not stand a chance.

However, certain system calls can't be interrupted. If an application is trapped in one of these, the program can't be killed. This happens very rarely, and indicates serious bug or a system malfunction (such as when dealing with uninterruptable NFS shares). The only hope is to wait a while to see if it clears up or reboot.

A process can also be defunct, meaning that its parent has not yet noticed that it's dead. If you encounter such processes, you can wait it out or try killing its parent instead. Such processes are called zombies.

Provided by

Most (all?) Linux distributions incorporate this from the [util-linux] project.

See also

  • kill command - signals processes or groups by ID.
  • killall command - signals all processes running a particular command.