After each command is interpreted by the system, an independent process, with a unique process identification number (PID), is created to perform the command. The system uses the PID to track the current status of each process.
Use the ps command to see what processes are currently running. In addition to showing the process identification number (listed under PID) for each process you own (created as a result of a command you typed), ps also shows you the terminal from which it was started (TTY), the cpu time it has used so far (TIME), and the command it is performing (COMMAND).
Adding the -l option to the ps command displays a variety of other information about the processes currently running, including the state of each process (listed under S). The codes used to show this are as follows:
O - Process is running on a processor.
Note that while ps is running, things can change. Since the ps command gives you only a snapshot of what's going on, it's only true for a split second after you type the command. The information may not be completely accurate by the time you see it.
The ps(1) command has more options than those covered here. Refer to the man Pages(1): User Commands.
To terminate a process:
The following example illustrates this procedure:
$ ps PID TTY TIME COMMAND 1291 co 0:12 -bin/csh (csh) 3250 p0 0:00 ps 1286 p1 0:05 -bin/csh (csh) 3248 p1 0:05 vi commands $ kill 1291 [1} Terminated -bin/csh/ (csh) $
$ ps | grep commandname
where commandname is the name of the command process you want to stop.
$ kill -9 PID#