System Administration Guide

Killing a Process (kill)

Sometimes it is necessary to stop (kill) a process. The process may be in an endless loop, or you may have started a large job that you want to stop before it is completed. You can kill any process that you own, and superuser can kill any processes in the system except for those with process IDs 0, 1, 2, 3, and 4.

Refer to kill(1) for more detailed information.

How to Kill a Process

  1. (Optional) To kill a process belonging to another user, become superuser.

  2. (Optional) Use output from the ps command to obtain the identification number of the process you want to display more information about.


    $ ps -e | grep process
    

    process

    Name of the process you want to display more information about. 

    The process identification number is in the first column of the output.

  3. Use the kill command to stop the process.


    $ kill [-9]PID ...
    

    -9

    Ensures that the process terminates promptly. 

    PID . . .

    ID of the process or processes to stop.  

  4. Use the ps command to verify that the process has been stopped.


    $ ps -ef | grep PID ...