produces a report summarizing execution statistics for current
processes. The bare ps
lists the process ID, the terminal the command was started from, how
much CPU time it has used, and the command itself. The output looks
something like this (it differs from system to system):
PID TT STAT TIME COMMAND
1803 p5 IW 0:00 -csh (csh)
1883 p5 IW 0:04 vi outline
1811 p6 IW 0:01 -csh (csh)
5353 p6 TW 0:01 vi 4890
By default, ps
lists only your own processes.
There are many times, though, when it's desirable to have a more
complete listing with a
lot of data about all of the processes currently running on the system.
The options required to do this differ between BSD UNIX and System V.
Under BSD UNIX,
the command is ps -aux
, which produces a table of all processes,
arranged in order of decreasing CPU usage at the moment when the ps
command was executed. [The -a
option gives processes belonging
to all users, -u
gives a more detailed listing, and -x
includes processes that no longer have a
controlling terminal (38.6
It is often useful to pipe this output to
which will display the most active processes:
ps -aux | head -5
USER PID %CPU %MEM SZ RSS TTY STAT TIME COMMAND
martin 12923 74.2 22.5 223 376 p5 R 2:12 f77 -o foo foo.F
chavez 16725 10.9 50.8 1146 1826 p6 R N 56:04 g94 HgO.dat
ng 17026 3.5 1.2 354 240 co I 0:19 vi benzene.txt
gull 7997 0.2 0.3 142 46 p3 S 0:04 csh
The meanings of the fields in this output (as well as others displayed
by the -l
option to ps
) are given in
The first line of this output shows that user martin
is running a
FORTRAN compilation (
This process has
12923 and is currently either running or
runable. User chavez
's process (PID 16725), executing the program
, is also running or runable, though at a lowered priority.
From this display, it's obvious who is using most system resources at this
have about 85% of the CPU and 73% of
the memory between them. However, although it does display total CPU time,
does not average the
values over time
in any way.
Table 38.1: ps Command Output Fields
||Username of process owner.
|UID (System V)
||Username of process owner.
||Estimated fraction of CPU consumed (BSD).
||Estimated fraction of system memory consumed (BSD).
||Virtual memory used in K (BSD) or pages (System V).
||Real memory used (in same units as SZ).
||Terminal port associated with process.
||Current process state; one (or more under BSD) of:
| S (System V)
||R: Running or runnable.
||I: Idle (BSD). Intermediate state (System V).
||T: Stopped (12.8
||Z: Zombie process (38.16
||D (BSD): Disk wait.
||P (BSD): Page wait.
||X (System V): Growing: waiting for memory.
||K (AIX): Available kernel process.
||W (BSD): Swapped out.
||N (BSD): Niced (39.9
:execution priority lowered.
||> (BSD): Execution priorityartificially raised (39.11
||Total CPU time used.
||Command line being executed (may be truncated).
|STIME (System V)
||Time or date process started.
|C (System V),
||Short term CPU-use factor; used by scheduler for
| CP (BSD)
||computing execution priority (PRI below).
||Flags associated with process (see ps
||Actual execution priority (recomputed dynamically).
||Process nice number (39.9
||Event process is waiting for.
A vaguely similar listing is produced by the System V ps -ef
UID PID PPID C STIME TTY TIME CMD
root 0 0 0 09:36:35 ? 0:00 sched
root 1 0 0 09:36:35 ? 0:02 /etc/init
gull 7997 1 10 09:49:32 ttyp3 0:04 csh
martin 12923 11324 9 10:19:49 ttyp5 56:12 f77 -o foo foo.F
chavez 16725 16652 15 17:02:43 ttyp6 10:04 g94 HgO.dat
ng 17026 17012 14 17:23:12 console 0:19 vi benzene.txt
The columns hold the username, process ID, parent's PID (the
PID of the process that created it), the current scheduler
value, the time the process started, its associated terminal, its
accumulated CPU time, and the command it is running. Note that
the ordering is by PID, not resource usage.
AIX's version of the ps
command supports both BSD
and System V options. The BSD options are not preceded by a
hyphen (which is a legal syntax variation), and the System V options
are. Thus, under AIX,
is not the same as
. The command is the System V version, however, even if
its output is displayed with the BSD column headings. Thus,
output is displayed in
is also useful in pipes; a common use is:
ps -aux | grep chavez
to see what user chavez
has currently running. [Under System V,
ps -u chavez
- from O'Reilly & Associates' Essential System Administration
, Chapter 7