Go to main content

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

Exit Print View

Updated: April 2019
 
 

How to Terminate a Process Using the pkill Command

  1. () To terminate the process of another user, 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 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. 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 no longer be listed in the output of the pgrep command.