System Administration Guide: Advanced Administration

ProcedureHow to Terminate a Process (kill)

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

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

    $ ps -fu user

    where user is the user that you want to display processes for.

    For example:

    $ ps -fu userabc
    userabc   328   323   2   Mar 12 ?         10:18 /usr/openwin/bin/Xsun
    :0 -nobanner -auth /var/dt/A:0-WmayOa
    userabc   366   349   0   Mar 12 ?         0:00 /usr/openwin/bin/fbconsole
    userabc   496   485   0   Mar 12 ?         0:09 /usr/dt/bin/sdtperfmeter
     -f -H -t cpu -t disk -s 1 -name fpperfmeter
    userabc   349   332   0   Mar 12 ?         0:00 /bin/ksh /usr/dt/bin/Xsession
    userabc   440   438   0   Mar 12 pts/3     0:00 -csh -c unsetenv _ PWD;
    unsetenv DT;     setenv DISPLAY :0;      
    userabc   372     1   0   Mar 12 ?         0:00 /usr/openwin/bin/speckeysd
    userabc   438   349   0   Mar 12 pts/3     0:00 /usr/dt/bin/sdt_shell -c

    The process ID is displayed in the first column of the output.

  3. Terminate the process.

    $ kill [signal-number] pid

    When no signal is included in the kill command-line syntax, the default signal that is used is –15 (SIGKILL). Using the –9 signal (SIGTERM) with the kill 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 process ID of the process that you want to terminate.

    Tip –

    When using the kill command to stop 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 kill command with the -9 signal.

  4. Verify that the process has been terminated.

    $ pgrep pid

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