Since Linux is a multi-user, multi-tasking operating system, there's undoubtedly a number of processes running simultaneously. You can view the running processes (yours, others, system) with the ps command and some of its options:
$ ps just yours at this login session $ ps -f full listing of process info $ ps -e all processes on the host $ ps -ef all processes, full info $ ps -uuser those belonging to user
In particular, you should pay attention to the process ID or PID of a process, since you can use this to kill any of your processes later with one of these variations of the kill command:
$ kill PID $ kill -9 PID
Regular users can kill only their own processes, while the administrator can kill anyone's.
![]() | Tip |
---|---|
Given the two variations for the kill shown above, you should always try to kill an unwanted process in that order. The first form of the command is a kinder, gentler way of terminating a process, while the second form is somewhat more brutal and should be used if the first form doesn't work. As Patrick Swayze once said in Roadhouse, "Be nice, until it's time to not be nice." |
![]() | Warning |
---|---|
There are, in fact, three different option formats for the ps command: Berkeley, System V and the GNU long options. The above represents a small example of using some System V options. Rather than get too involved in the possibilities for ps usage, we'll leave that for a later chapter on process management. If you're feeling ambitious, you can read the documentation on your own time and experiment. |