• Main Menu
  • How to Kill a Process in Unix

    A computer process is a computer program that is executing and has a unique process identification or PID. On the Unix Operating System (OS), a process may be running in the background, foreground, or be in a suspended state. On Unix, the OS shell will not return the prompt to the end-user until the current process that is executing finishes. As a result, many processes that take a significant amount of time to run and keep you from using the Unix console until it finishes running. A common task that arises for Unix users is to kill or background a process in order to conduct other tasks on the computer. In order to about or kill a process a signal has to be sent via keystroke or the Unix kill command.

    Steps to Kill a Unix Process with a Single Keystroke

    Step 1 – Enter the following command to get specific information on the running process on your computer:

    % ps

    Step 2 – Depress the “RUB” or “DEL” key if your computer keyboard does not have the “RUB” key and the “_” key at the same time. This will send the interrupt signal to the executing process.

    Step 3 – When using the keystroke method to kill a Unix process, you will want to remove the “core” file saved to the computer’s hard drive as a result of using the command. To do so, enter the following command to remove the file:

    rm -f core

    Steps to Kill a Unix Process with the “Kill Command”

    Step 1 – Enter the “ps” command as outlined above to retrieve the PID for the process that you need to kill on Unix. For example,

    ps myProcess

    will return something similar to:


    1234 dz07 0:45 edit myBook

    1235 dz07 0:37 -csh

    Step 2– Enter the following command to kill the first process listed in the example in step 1:

    kill -1 1234

    to kill the second process that is active enter:

    kill -1 1235

    Step 3 – If the Kill -1 switch does not work, you may need to use the -9 argument to clear the process from your computer:

    kill -9 1234

    kill -9 1235

    Step 4 – You can alternatively kill all instances of a given process by using the killall command. The syntax for this command is:

    killall <pname>

    Got Something To Say:

    Your email address will not be published. Required fields are marked *

    One comment
    1. Xagyg

      9 March, 2011 at 1:05 am

      I usually use – in this order
      kill something       # i.e. kill -15 something (15 is software interrupt)
      kill -1 something   # (1 is terminal line hangup)
      kill -2 something   # (2 interrupt program)
      kill -3 something   # (3 quit program)
      kill -9 something   # (9 destroy) – last resort
      All signals prior to 9 gives the process some chance to clean up. If none of them terminate the process use the sledgehammer (-9).

    177 queries in 0.698 seconds.