kill

Stop a process from running, either via a signal or forced termination.

Syntax
     kill [-s signal_name] pid ...
     kill -signal_name pid ...
     kill -signal_number pid ...
     kill -l [exit_status]

Options
      -s signal_name
	     A symbolic signal name specifying the signal to be sent instead
	     of the default TERM.

     -signal_name
	     A symbolic signal name specifying the signal to be sent instead
	     of the default TERM.

     -signal_number
	     A non-negative decimal integer, specifying the signal to be sent
	     instead of the default TERM.

     -l [exit_status]
	     If no operand is given, list the signal names; otherwise, write
	     the signal name corresponding to exit_status.

     The following pids have special meanings:
     -1	     If superuser, broadcast the signal to all processes; otherwise
	     broadcast to all processes belonging to the user.

     Some of the more commonly used signals:
     1	     HUP (hang up)
     2	     INT (interrupt)
     3	     QUIT (quit)
     6	     ABRT (abort)
     9	     KILL (non-catchable, non-ignorable kill)
     14	     ALRM (alarm clock)
     15	     TERM (software termination signal)

     Some shells may provide a builtin kill command which is similar or iden-
     tical to this utility.  Consult the builtin(1) manual page.

The kill utility sends a signal to the processes specified by the pid operand(s). Only the super-user may send signals to other users' processes.

EXAMPLES

List the running process
$ ps
PID TTY TIME CMD
1293 pts/5 00:00:00 MyProgram

Then Kill it
$ kill 1293
[2]+ Terminated MyProgram

Or to really really Kill it
$ kill -9 1293

To close an application you can also send an applescript quit command:
$ osascript -e 'quit app "safari.app"'

"Whom the gods love dies young" ~ Menander 300 BC

Related:

ps - List running processes (returns PID)
killall - Kill all processes
sigaction(2) -
lsof - List open files


© Copyright SS64.com 1999-2014
Some rights reserved