
- Order:
- Duration: 4:02
- Published: 2006-12-13
- Uploaded: 2011-01-20
- Author: NerdcoreForLife
these configurations will be saved for each time you visit this page using this browser
kill
is a command that is used in several popular operating systems to send signals to running processes, for example to request the termination of this process.
kill
is a command used to send a signal to a process. By default, the message sent is the termination signal, which requests that the process exit. But kill is something of a misnomer; the signal sent may have nothing to do with process killing. The kill
command is a wrapper around the kill()
system call, which sends signals to processes or process groups on the system, referenced by their numeric process IDs (PIDs) or process group IDs (PGIDs). kill
is always provided as a standalone utility as defined by the POSIX standard. However, most shells have built-in kill
commands that may slightly differ from it.
There are many different signals that can be sent (see signal for a full list), although the signals in which users are generally most interested are SIGTERM and SIGKILL. The default signal sent is SIGTERM. Programs that handle this signal can do useful cleanup operations (such as saving configuration information to a file) before quitting. However, many programs do not implement a special handler for this signal, and so a default signal handler is called instead. Other times, even a process that has a special handler has gone awry in a way that prevents it from properly handling the signal.
All signals except for SIGKILL and SIGSTOP can be "intercepted" by the process, meaning that a special function can be called when the program receives those signals. The two exceptions SIGKILL and SIGSTOP are only seen by the host system's kernel, providing reliable ways of controlling the execution of processes. SIGKILL kills the process, and SIGSTOP pauses it until a SIGCONT is received.
Unix provides security mechanisms to prevent unauthorized users from killing other processes. Essentially, for a process to send a signal to another, the owner of the signaling process must be the same as the owner of the receiving process or be the superuser.
The available signals all have different names, and are mapped to certain numbers. It is important to note that the specific mapping between numbers and signals can vary between Unix implementations. SIGTERM is often numbered 15 while SIGKILL is often numbered 9.
The process can be sent a SIGKILL signal in three ways:
Other useful signals include HUP, TRAP, INT and ALRM. HUP sends the SIGHUP signal. Some daemons, including Apache and Sendmail, re-read configuration files upon receiving SIGHUP, so the kill command may be used for this too. A SIGINT signal can be generated very simply by pressing in most Unix shells. It is also common for to be mapped to SIGTSTP, and for (backslash) to be mapped to SIGQUIT, which can force a program to do a core dump.
xmms
, the user would run the command killall xmms
. This would kill all processes named xmms
.kill `ps --no-headers -C firefox -o pid`
whereas with pkill, one can simply type pkill firefox
.kill
is a predefined command alias for the Stop-Process
cmdlet.
Microsoft Windows XP, Vista and 7 include the command taskkill
to terminate processes. An "unsupported" version of kill
was included in several releases of the Microsoft Windows Resource Kits (aka "RezKits") available for Windows NT 3.x, NT 4.0, Windows 2000 and Microsoft Windows Server 2003, the most efficacious of these being Version 3.5 of Kill, Copyright (C) 1994 Microsoft Corp.
GNU versions of kill
have been ported via Cygwin and run inside of the Unix environment subsystem that Microsoft Windows Services for UNIX provides (Microsoft acquired Windows Services for Unix wholesale via their purchase of Softway Systems and their Interix product on September 17, 1999).
Confirm Are you sure you want to perform this action? Performing operation "Stop-Process" on Target "powershell (6832)". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): n PS C:\>
kill
command to terminate background processes.
Stop the process with the process identifier "42":
A similar command provided is called slay
, which does the same but for processes that refuse to be killed this way.
kill troff | rc
Category:Unix SUS2008 utilities Category:Unix process and task management-related software Category:Process (computing) Category:Windows administration
This text is licensed under the Creative Commons CC-BY-SA License. This text was originally published on Wikipedia and was developed by the Wikipedia community.