Go to main content

Managing System Information, Processes, and Performance in Oracle® Solaris 11.4

Exit Print View

Updated: October 2019
 
 

How to Terminate a Process With the pkill Command

  1. () To terminate a process that you do not own, assume the root role.
  2. Obtain the process ID for the process that you want to terminate.
    # pgrep process

    For example:

    # pgrep firefox
    587
    566

    The process ID is displayed in the output.

  3. Terminate the process.
    # pkill [signal] PID
    signal

    When no signal is included in the pkill command-line syntax, the default signal that is used is -15 (SIGKILL). Using the -9 signal (SIGTERM) 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 because data might be lost.

    PID

    The process ID of the process to stop.


    Tip  -  When trying to terminate a process, first try using the pkill command by itself without including a signal option. If the process does not terminate after a few minutes, use the pkill command with the –9 signal.
  4. Verify that the process has been terminated.
    # pgrep process

    The process you terminated should not be listed.