6.3 Cancelling a ProcessYou may decide that you shouldn't have put a process in the background. Or you decide that the process is taking too long to execute. You can cancel a background process if you know its process ID. 6.3.1 killThe kill command aborts a process. The command's format is:
kill terminates the designated process IDs (shown under the PID heading in the ps listing). If you do not know the process ID, do a ps first to display the status of your processes. In the following example, the "sleep n " command simply causes a process to "go to sleep" for n number of seconds. We enter two commands, sleep and who , on the same line, as a background process. % We decided that 60 seconds was too long a time to wait for the output of who . The ps listing showed that sleep had the process ID number 21088, so we used this PID to kill the sleep process. You should see a message like "terminated" or "killed"; if you don't, use another ps command to be sure the process has been killed. The who command is executed immediately, since it is no longer waiting on sleep ; it lists the users logged into the system. 6.3.2 Problem checklist
|
|