Phoebe 1,
2, 3,
4 Catalogs
'n Manuals
Hardening
| Managing ProcessesFrom time to time you may wish to view processes that are running on Linux. To obtain a list of these processes, type ``ps -aux'', which will look similar to the following:
The list shows you the owner of the process (“nobody” for special services such as web servers), the process identification number, the % of CPU time the process is currently using, the % of memory the process is consuming, and other related information, as well as a description of the task itself. To get more information on a given process, type ``ps pid'' (where “pid” is the process identification number). Looking at our example above, “ps 10704” would display:
This would tell you that this particular process is a web server (the Apache web server appears multiple times in the process list; for information on why see the section called Web Server and HTTP Caching Proxy Administration in Chapter 7). If you happen to notice a service is not operating, you can use the “kill -HUP pid” (where “pid” is the process identification number as shown in the process list produced with “ps”). For example, if Internet services (a process called inetd, process #123 in our example) are not working as they should, a ``kill -HUP 123'' (or even safer, use the ``killall'' command and specify the process name: ``killall -HUP inetd'') should restart the process. The -HUP option to the kill command means “hang up”; the process knows that it is supposed to reload itself. Another thing to try if you are unable to resolve the problem would be to shut the system down and reboot it (see the section called System Shutdown and Restart in Chapter 6 for details). At times, you may find it necessary to temporarily suspend a process, and then resume its execution at a later time. For example, you may be running a CPU-intensive job and wish to burn an IDE-based CDRecordable. Since IDE-based devices rely on the CPU for much of the work behind input/output, they are prone to buffer starvation if your CPU is too busy, and you end up with a useless coaster instead of a properly prepared CD! The following two commands will suspend a process, and the resume it, respectively:
Red Hat provides a better way of starting and stopping some processes, which are covered in the section called Starting and Stopping Processes below. |