18

Why was it decided to call the kill command "kill"?

I mean, yes, this utility is often used to terminate processes, but it can actually be used to send any signal.

Isn't it slightly confusing? Maybe there are some historical reasons.

All I know from man kill that this command appeared in Version 3 AT&T UNIX.

gnat
  • 20,543
  • 29
  • 115
  • 306
shabunc
  • 2,454

3 Answers3

28

This is Unix.

kill is able not to kill a process.

mv is able to rename and not only move files from one place to another.

touch is able to create a file and not only change its last modification time.

od means Octal Dump, but is able to perform many more kinds of dumps.

yes is able to output no.

More exotic:

grep is named after the ed command that perform the same operation: g/re/p

awk is named after its authors: Aho, Weinberger and Kernighan.

yacc means Yet Another Compiler Compiler. Note that bison is the GNU yacc.

mouviciel
  • 15,491
23

Originally, the kill command could only kill a process, only later was kill enhanced to allow you to send any signal.

Since version 7 of Unix (1979) the default has been to signal the process in a way which can be caught and either handled gracefully or ignored (by sending a SIGTERM signal), but it can also be used to pull the rug out from under a process (a kill -9 sends a SIGKILL signal which cannot be caught and thus cannot be ignored).

Background

Computing, and Unix in particular, is rife with metaphor.

The main metaphor for processes is that of a living thing which is born, lives and dies.

In Unix all processes except init have parents, and any process which spawns other processes has children. Processes may become orphaned (if their parent dies) and can even become zombies, if they hang around after their death.

Thus, the kill command fits in with this metaphor.

Unix Archaeology

From the manual page from version 4 of Unix (the version where kill was introduced, along with ps) we find:

NAME
        kill - do in an unwanted process
SYNOPSIS
        kill processid ...
DESCRIPTION
        Kills the specified processes.
        The processid of each asynchronous process
        started with `&' is reported by the shell.
        Processid's can also be found by using ps (I).

        The killed process must have
        been started from the same typewriter
        as the current user, unless
        he is the superuser.
SEE ALSO
        ps(I), sh(I)

I particularly like the final section of this man page:

BUGS
        Clearly people should only be allowed to kill
        processes owned by them, and having the same typewriter
        is neither necessary nor sufficient.

By the time fifth edition had come around, the kill command had already been overloaded to allow any signal to be sent.

From the Unix Programmers Manual, Fifth Edition (p70):

If a signal number preceded by "-" is given
as an argument, that signal is sent instead of
kill (see signal (II)).

The default though was to send a signal 9, as signal 15 did not yet exist (see p150).

With version 6 the kill man page no longer mentioned the same typewriter bug.

It was only with version 7 of Unix that signal 15 was introduced (see see the signal(2) and kill(1) man pages for v7) and kill switched to that rather than using signal 9.

Mark Booth
  • 14,352
0

Unix version 7 kill manual page states:

kill - terminate a process with extreme prejudice

and

This will kill processes that do not catch the signal; in particular `kill -9 ...'  is a sure kill.

There would be good no reason not to call that command kill which is certainly the best metaphor available.

jlliagre
  • 149