351
Chapter 21:
Introduction to Linux Systems Administration
causes the kernel to flush the cache immediately. For example, to ensure that the disk
cache has been flushed, type the following:
[root@ford /root]# sync ; sync
The sync command does not have any command-line parameters.
Process Manipulation
Under Linux (and UNIX in general), each running program is composed of at least
one process. From the operating system's standpoint, each process is independent of
one another, and unless you specifically ask the processes to share resources with each
other, they are confined to the memory and CPU allocation assigned to them. Processes
that overstep their memory allocation (which could potentially corrupt another
running program and make the system unstable) are immediately killed. This method
of handing processes has been one of the key reasons that UNIX has been able to
sustain its claims to system stability for so long--user applications cannot corrupt other
user programs or the operating system.
This section discusses the tools used to list and manipulate processes. This
information is very useful to systems administrators, since it's always important to
keep an eye on what's going on.
ps: List Processes
The ps command lists all of the processes in a system, as well as their state, size, name,
owner, CPU time, wall clock time, and much more. The command has many command-
line parameters. Table 21-10 lists the ones that are most commonly used.
The most common parameter used with the ps command is -auxww, which shows
all of the processes (regardless of whether or not they have a controlling terminal),
Option Description
-a
Show all processes with a controlling terminal, not just the current user's.
-r
Show only running processes.
-x
Show processes that do not have a controlling terminal.
-u
Show the process owners.
-f
Show which processes are the parents to which other processes.
-l
Produce long format.
-w
Show the process's command-line parameters (up to half a line).
-ww
Show all of a process's command-line parameters, despite length.
Table 21-10.
Common ps Command Options