System Administration Guide: Advanced Administration

ProcedureHow to Terminate a Process (pkill)

  1. (Optional) Become superuser or assume an equivalent role to terminate the process of another user.

  2. Obtain the process ID for the process that you want to terminate.

    $ pgrep process

    where process is the name of the process that you want to terminate.

    For example:

    $ pgrep netscape

    The process ID is displayed in the output.

    Note –

    To obtain process information on a Sun RayTM, use the following commands:

    # ps -fu user

    This command lists all user processes.

    # ps -fu user | grep process

    This command locates a specific process for a user.

  3. Terminate the process.

    $ pkill [signal] process

    When no signal is included in the pkill command-line syntax, the default signal that is used is –15 (SIGTERM). Using the –9 signal (SIGKILL) with the pkill command ensures that the process terminates promptly. However, the –9 signal should not be used to kill certain processes, such as a database process, or an LDAP server process. The result is that data might be lost.


    Is the name of the process to stop.

    Tip –

    When using the pkill command to terminate a process, first try using the command by itself, without including a signal option. Wait a few minutes to see if the process terminates before using the pkill command with the -9 signal.

  4. Verify that the process has been terminated.

    $ pgrep process

    The process you terminated should no longer be listed in the output of the pgrep command.