System V ATT Flavored ps Command

The output of this command is an extensive listing of process−related data sufficient for most administrative needs.

2.4.3.1.2 System V ATT Flavored ps Command

The ps command displays the status of currently running processes; without any options, only the processes associated with the current terminal are displayed. The basic options are: e option • Displays all processes f option • Produces a full listing, including the process start time l option • Displays a long listing with many additional fields The regular output of this command is a so−called short listing as opposed to the full or long listing. A short listing contains only the user and process IDs including parent process ID, terminal identifier, start and cumulative execution time, and the command name. An example of the short listing for all processes follows: ps −e UID PID PPID C STIME TTY TIME COMMAND root 0 0 0 Dec 31 ? 0:05 swapper root 1 0 0 11:23:17 ? 0:00 init root 2 0 0 11:23:16 ? 0:00 vhand −−−−− dubey 1550 1549 0 08:40:13 ttys0 0:00 −sh bjl 1618 1591 10 09:25:59 ttys1 0:00 ps −ef A full or long listing displays many additional pieces of information: ps −ef | head −6 F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME COMD 3 S root 0 0 0 128 20 1e0568 0 Dec 31 ? 0:06 swapper 1 S root 1 0 0 168 20 2056540 54 7ffe6000 May 16 ? 0:00 init 3 S root 2 0 0 128 20 2056480 0 1ee3d0 May 16 ? 0:01 vhand 3 S root 3 0 0 128 20 20564c0 0 1ec4d4 May 16 ? 0:00 statdaemon 3 S root 7 0 0 128 20 2056500 0 1e8dc0 May 16 ? 0:00 unhash− daemon ps −l | head −5 F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME COMD 1 S 201 9444 9443 0 158 20 2151100 52 350c1c ttys1 0:00 sh 1 S 0 9443 106 0 154 20 2151a40 17 221728 ttys1 0:00 telnetd 1 R 201 9473 9472 7 179 20 20d7f40 17 ttys1 0:00 ps 1 S 201 9472 9444 4 154 20 2151680 6 3300e4 ttys1 0:00 head The column headings and the meaning of the columns in a ps listing are given below; the letters f and l indicate the option full or long that causes the corresponding heading to appear; all means that the heading always appears. Note that these two options determine only which information would be displayed for a process; they do not determine the processes to be listed. Column Meaning 60 1 = in core 2 = system process 4 = locked in core e.g., for IO 10 = traced by another process 20 = another tracing flag S l The state of the process: 0 = nonexistent S = sleeping W = waiting R = running I = intermediate Z = terminated T = stopped X = growing UID f, l The real user ID number of the process owner; the login name is printed under the − f option PID all The process ID of the process; it is possible to kill a process if you know this datum PPID f, l The process ID of the parent process C f, l Processor utilization for scheduling PRI l The priority of the process; higher numbers mean lower priority NI l Nice value; used in priority computation ADDR l The memory address of the process, if resident; otherwise, the disk address SZ l The size in blocks of the core image of the process WCHAN l The event for which the process is waiting or sleeping; if blank, the process is running STIME f Starting time of the process. The starting date is printed instead if the elapsed time is greater than 24 hours TTY all The controlling terminal for the process TIME all The cumulative execution time for the process reported in the form min:sec COMD all The command name; the full command name and its arguments are printed under the − f option. This field is renamed COMMAND except when the −l option is specified The most common format of the System V flavored ps command is: ps −ef The full listing provides all the process−related data we need for a successful administration.

2.4.3.2 Destroying Processes The UNIX kill command will eliminate a process entirely: