kill

terminate process 

Command, KornShell Built-in


SYNOPSIS

kill -l [exit_status]

kill [-s signal_name] [pid ...] [job-identifier ...]


DESCRIPTION

kill terminates a process by sending it a signal. The default signal is SIGTERM.

On 7/2008R2/8/2012/10/2016, if you do not have the permissions required to kill a process, you may still be able to terminate it if you have the SeDebug privilege. The kill command automatically enables it if required.

You may specify the following items on the command line:

-l [exit_status

displays the names of all supported signals. If you specify exit_status, and it is the exit code of a terminated process, kill displays the terminating signal of that process.

-S hostname 

terminates a process on the remote system hostname. The remote system must be a 7/2008R2/8/2012/10/2016 system and you must have administrator privileges on that system. To terminate the process, kill installs a service named psproxy on the remote system (if it isn't already installed) and communicates with that service.

Note:

This option is only available in the external utility version of kill and not with the MKS KornShell built-in version. You can explicitly specify kill.exe instead of kill to invoke the external utility.

-s signal_name 

sends the signal signal_name to the process instead of the SIGTERM signal.

-signal_name 

is an obsolete equivalent of -s signal_name.

-signal_number 

is an obsolete method of specifying a positive integer which represents the signal to be used (instead of SIGTERM) as the sig argument in the effective call to kill. The relationship between signal_number and the portable signal_name is shown in Table 1, Integer Values of Signals.

signal_number signal_name

0 0
1 SIGHUP
2 SIGINT
3 SIGQUIT
6 SIGABRT
9 SIGKILL
14 SIGALRM
15 SIGTERM

Table 1: Integer Values of Signals

job-identifier 

is the job identifier reported by the shell when a process is started with &. It is one way to identify a process. It is also reported by the jobs command.

pid 

is the process ID that the shell reports when a process is started with &. You can also find the pid using the ps command.

The killed process must belong to the current user, unless he or she is the superuser.

When the process being signalled is a NuTCRACKER Platform process, all signals are delivered using that platform's kill() API. The process responds in the same way it would to an external NuTCRACKER Platform application calling kill().

When the process being signalled is an MKS Toolkit utility not dependent upon the NuTCRACKER Platform (that is, those utilities in $ROOTDIR/mksnt) or a console subsystem application, only the SIGKILL signal has any effect and results in a call to the Windows TerminateProcess() API.

When the process being signalled is a Windows subsystem application (that is, it is not a NuTCRACKER Platform application) or has a message pump, SIGHUP and SIGTERM are mapped to WM_CLOSE and passed to the application.

Because the MKS KornShell is not a NuTCRACKER Platform application, the built-in trap utility can only handle system generated events such as CTRL-C. It cannot receive kill signals from another non-NuTCRACKER Platform application. Using the command kill -1 on the shell itself (sh.exe) results in a call to TerminateProcess() not a trappable signal.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

The specified signal was invalid or there was exactly one job or process that could not be killed.

2 

Failure due to an invalid command line argument or there were exactly two jobs or processes that could not be killed.

>2 

Tells the number of jobs or processes that could not be killed.

Possible error messages include:

"job-identifier" is not a job 

You specified a job-identifier that is not valid.

"signal_name" is not a valid signal 

You specified a non-integer signal for kill or a signal that is outside the range of valid signal numbers.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016. Note that under 7/2008R2/8/2012/10/2016 the only signals supported for arbitrary processes are SIGHUP, SIGTERM, and SIGKILL. kill is provided as both an external utility and a built-in MKS KornShell utility.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
jobs, ps, sh


PTC MKS Toolkit 10.1 Documentation Build 15.