kill Command

Purpose

Sends signals to processes or jobs to end, interrupt, or control their execution.

Syntax

kill [ -0 ] [ -9 ] [ -15 ] [ -l ] [ -L ] pid | jobspec ...

Description

The kill command sends signals to processes or jobs to end, interrupt, or control their execution. in PowerVC virtual appliance only safe and commonly needed signals are allowed for security. Arbitrary signal numbers or names are restricted.

Flags

Table 1. Flags
Item Description
-0 Checks if the specified process exists. This option does not send any signal to the process. The -0 option returns 0 if the process exists and is accessible. A nonzero value is returned if the process does not exist.
-9 Sends the SIGKILL signal that forces immediate termination of the process. This option cannot be ignored.
-15 Sends the SIGTERM signal that requests graceful termination. This option is the default option.
-l or -L Lists all the available signal names and their numbers.
Note: Only then signals specified by the -0, -9, and -15 flags are allowed. All other signals and options are restricted.

Positional arguments

Table 2. Positional arguments
Argument Required? Description
pid | jobspec Yes Specifies the process ID (PID) or the job specification. You can specify multiple PIDs separated by a white space.

Examples

  1. To gracefully end a process with PID 5678, enter the following command:
    kill 
  2. To explicitly send SIGTERM signal to a process with PIF 5678, enter the following command:
    kill -15 5678
  3. To forcefully end a hung process with PID 9012, enter the following command:
    kill -9 9012
  4. To check whether a process with PID 3456 is active, enter the following command:
    kill -0 3456
  5. To list all available signals, enter the following command:
    kill -l
    
    or 
    
    kill -L
  6. To end multiple processes with PIDs 1001, 1002, and 1003, enter the following command:
    kill 1001 1002 1003
  7. To end a background process, enter the following commands:
    sleep 100
    kill %1