Topics Map > University of Chicago > IT Services > Applications, Operating Systems, & Devices
Basic Unix - Killing Inactive Processes
This article describes how to kill inactive processes in Unix.
Stopping a program is referred to as "killing a process." In order to kill a process, you'll need to do two things: first, use the ps command to find out what the process number is, and then use the kill</TT> command to stop the process.
- Type "ps -ef | grep myusername" (no quotes) at the ">"
prompt. You'll get output formatted like this:
myusername 21414 17383 0 11:57:25 pts/29 0:00 mail
myusername 23477 17383 0 12:16:08 pts/29 0:00 grep myusername
myusername 21513 21414 0 11:58:34 pts/29 0:00 /usr/local/bin/tcsh -c /usr/local/bin/less
myusername 17383 17380 0 11:23:25 pts/29 0:02 -tcsh
myusername 21515 21513 0 11:58:34 pts/29 0:00 /usr/local/bin/less
- Look at the lines, and find the oldest row (see the starting times in the middle -- fifth column) which has "-tcsh" in the far right column.
- You should first attempt terminating the command simply with "kill #####" where ##### is the entry in the second column for that row also know as the PID.
- If terminating the command fails in step 3, type "kill -9 #####" (again, no quotes) where ##### is the PID. That will kill the old process.
The tcsh process is the "shell" -- the basic "display a > and wait for the person to tell me what program to run" program that all other programs run over. Usually killing a tcsh program will kill all the programs run in that session. However, if it doesn't, simply repeat this step for all other programs which don't end automatically.