1PS(1) General Commands Manual PS(1)
2
3
4
6 ps - process status
7
9 ps [ acgklnrtuwxU# [ core [ swap [ system ] ] ] ]
10
12 Ps prints certain indicia about active processes. To get a complete
13 printout on the console or lpr, use ``ps axlw'' For a quick snapshot of
14 system activity, ``ps au'' is recommended. A hyphen may precede
15 options with no effect. The following options may be specified.
16
17 a asks for information about all processes with terminals (ordi‐
18 narily only one's own processes are displayed).
19
20 c causes only the comm field to be displayed instead of the argu‐
21 ments. (The comm field is the tail of the path name of the file
22 the process last exec'ed.) This option speeds up ps somewhat
23 and reduces the amount of output. It is also more reliable
24 since the process can't scribble on top of it.
25
26 g asks for all processes. Without this option, ps only prints
27 ``interesting'' processes. Processes are deemed to be uninter‐
28 esting if they are process group leaders, or if their arguments
29 begin with a `-'. This normally eliminates shells and getty
30 processes.
31
32 k causes the file /usr/sys/core is used in place of /dev/kmem and
33 /dev/mem. This is used for postmortem system debugging.
34
35 l asks for a long listing. The short listing contains the user
36 name, process ID, tty, the cumulative execution time of the
37 process and an approximation to the command line.
38
39 n asks for numeric rather than symbolic wchans. This flag implies
40 the ``l'' flag.
41
42 r asks for ``raw'' output. A non-human readable sequence of
43 structures is output on the standard output. There is one
44 structure for each process, the format is defined by <psout.h>
45
46 tttyname
47 restricts output to processes whose controlling tty is the spec‐
48 ified ttyname (which should be specified as printed by ps,
49 including t? for processes with no tty). This option must be
50 the last one given.
51
52 u A user oriented output is produced. This includes the name of
53 the owner of the process, process id, nice value, size, tty, cpu
54 time used, and the command.
55
56 w tells ps you are on a wide terminal (132 columns). Ps normally
57 assumes you are on an 80 column terminal. This information is
58 used to decide how much of long commands to print. The w option
59 may be repeated, e.g. ww, and the entire command, up to 128
60 characters, will be printed without regard to terminal width.
61
62 x asks even about processes with no terminal.
63
64 U causes ps to update a private database where is keeps system
65 information. Thus ``ps -U'' should be included in the /etc/rc
66 file.
67
68 # A process number may be given, (indicated here by #), in which
69 case the output is restricted to that process. This option must
70 also be last.
71
72 A second argument tells ps where to look for core if the k option is
73 given, instead of /usr/sys/core. A third argument is the name of a
74 swap file to use instead of the default /dev/swap. If a fourth argu‐
75 ment is given, it is taken to be the file containing the system's
76 namelist. Otherwise, ``/unix'' is used.
77
78 The output is sorted by tty, then by process ID.
79
80 The long listing is columnar and contains
81
82 F Flags associated with the process. These are defined by #define
83 lines in /usr/include/sys/proc.h.
84
85 S The state of the process. 0: nonexistent; S: sleeping; W: wait‐
86 ing; R: running; I: intermediate; Z: terminated; T: stopped.
87
88 UID The user id of the process owner.
89
90 PID The process ID of the process; as in certain cults it is possi‐
91 ble to kill a process if you know its true name.
92
93 PPID The process ID of the parent process.
94
95 CPU Processor utilization for scheduling.
96
97 PRI The priority of the process; high numbers mean low priority.
98
99 NICE Used in priority computation.
100
101 ADDR The memory address of the process if resident, otherwise the
102 disk address.
103
104 SZ The size in blocks (512 bytes) of the memory image of the
105 process.
106
107 WCHAN The event for which the process is waiting or sleeping; if
108 blank, the process is running.
109
110 TTY The controlling tty for the process.
111
112 TIME The cumulative execution time for the process.
113
114 COMMAND
115 The command and its arguments.
116
117 A process that has exited and has a parent, but has not yet been waited
118 for by the parent is marked <defunct>. Ps makes an educated guess as
119 to the file name and arguments given when the process was created by
120 examining memory or the swap area. The method is inherently somewhat
121 unreliable and in any event a process is entitled to destroy this
122 information, so the names cannot be counted on too much.
123
125 /unix system namelist
126 /dev/kmem kernel memory
127 /dev/swap swap device
128 /usr/sys/core core file
129 /dev searched to find swap device and tty names
130 /var/run/psdatabase system namelist and device information
131
133 kill(1), w(1), pstat(8)
134
136 Things can change while ps is running; the picture it gives is only a
137 close approximation to reality.
138
139 Some processes, typically those in the background, are printed with
140 null or garbaged arguments, even though the process has not swapped.
141 (Sometimes ps even loses on its own arguments!) In these cases, the
142 name of the command is printed in parentheses.
143
144 When automatic crash dumps are enabled, /usr/sys/core is not a sensible
145 default core file name.
146
147
148
1493rd Berkeley Distribution PS(1)