Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ps(C) — OpenDesktop 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getty(M)

kill(C)

nice(C)


 ps(C)                         06 January 1993                          ps(C)


 Name

    ps - report process status

 Syntax

    ps [ options ]

 Description

    The ps command prints certain information about active processes.
    Without options, information is printed about processes associated with
    the controling terminal.  Output consists of a short listing containing
    only the process ID, terminal identifier, cumulative execution time, and
    the command name.  Otherwise, the information that is displayed is con-
    trolled by the selection of options.

    Options accept names or lists as arguments.  Arguments can be either
    separated from one another by commas or enclosed in double quotes and
    separated from one another by commas or spaces.  Values for proclist and
    grplist must be numeric.

    The options are given in descending order according to volume and range
    of information provided:

    -e  Print information about every process now running.

    -d  Print information about all processes except process group leaders.

    -a  Print information about all processes most frequently requested:  all
        those except process group leaders and processes not associated with
        a terminal.

    -f  Generate a full listing (see below).

    -l  Generate a long listing (see below).

    -n name     Valid only for users with a real user ID of root or a real
                group ID of sys.  Takes argument signifying an alternate sys-
                tem name in place of /unix.  This option is used when the
                kernel has been relinked and the executable file /unix does
                not correspond to the kernel loaded into memory. In this
                case, the argument is the filename of the UNIX executable
                that was loaded when the machine was last booted; for exam-
                ple, /unix.old.

    -t termlist List only process data associated with the terminal given in
                termlist.  Terminal identifiers may be specified in one of
                two forms: the device's filename (for example, tty04) or, if
                the device's filename starts with tty, just the digit iden-
                tifier (for example, 04).

    -p proclist List only process data whose process ID numbers are given in
                proclist.

    -u uidlist  List only process data whose user ID number or login name is
                given in uidlist.  In the listing, the numerical user ID will
                be printed unless you give the -f option, which prints the
                login name.

    -g grplist  List only process data whose process group leader's ID num-
                ber(s) appears in grplist.  (A group leader is a process
                whose process ID number is identical to its process group ID
                number. A login shell is a common example of a process group
                leader.)

    Under the -f option, ps tries to determine the command name and arguments
    given when the process was created by examining the user block.  Failing
    this, the command name is printed, as it would have appeared without the
    -f option, in square brackets.

    The column headings and the meaning of the columns in a ps listing are
    given in the following text; the letters -f and -l indicate the option
    (full or long, respectively) that causes the corresponding heading to
    appear; if no option letter is given, the heading always appears.  Note
    that these two options determine only what information is provided for a
    process; they do not determine which processes will be listed.

    F  (-l)     Octal flags which are added together to give more information
                about the current status of a process.

                00  If shown on its own, the process has terminated; its pro-
                    cess table entry is now available.

                01  A system process which is part of the kernel and always
                    resident in primary memory. sched (the swapper), vhand
                    (the pager), and bdflush (the buffer cache manager) are
                    all system processes.

                02  Parent is tracing process.

                04  Tracing parent's signal has stopped the process; the
                    parent is waiting ( ptrace(S)).

                10  Process is sleeping at less than or equal to priority 25
                    and cannot be awakened by a signal; for example, while
                    waiting for an inode to be created.

                20  Process is loaded in primary memory; it has not been
                    swapped out to disk.

                40  Process is currently locked in primary memory and cannot
                    be swapped out until an event completes; for example,
                    while performing raw I/O.

                200 Process is either in a Stream poll, or a select(S) system
                    call.

    S  (-l)     The state of the process:

                O   Process is running on a processor.

                S   Sleeping: process is waiting for an event to complete.

                R   Runnable: process is on run queue.

                I   Idle: process is being created.

                Z   Zombie state: process terminated and parent not waiting.

                T   Traced: process stopped by a signal because parent is
                    tracing it.

                B   SXBRK state: process is waiting for more pages of memory
                    to become available.

    UID  (-f, -l)
                The user ID number of the process owner (the login name is
                printed under the -f option).

    PID         The process ID of the process (this number is needed in order
                to kill a process).

    PPID  (-f, -l)
                The process ID of the parent process.

    C  (-f, -l) A measure of recent CPU usage by the process; the scheduler
                combines this quantity with the nice(C) value of the process
                to calculate its priority.

    PRI  (-l)   The priority of the process (higher numbers mean lower prior-
                ity). The swapper (sched) sleeps at the highest priority (0).
                This ensures that it will be the next process to execute if
                it is put on the run queue. Processes with a priority less
                than or equal to 39 are sleeping in system mode while waiting
                for a system resource to become available. If the priority is
                less than or equal to 25, they are also immune to signals
                while protecting critical data structures. Processes with a
                priority in the range 40 to 120 are in user mode and may be
                selected by the scheduler to run.

    NI  (-l)    The nice value of the process.

    ADDR1  (-l)
    ADDR2  (-l) The page frame numbers of the first two pages of the u-area
                (user area) of the process. (The user area contains informa-
                tion about a process which is only needed by the UNIX kernel
                when the process is executing.)

    SZ  (-l)    The size (in kilobytes) of the virtual data and stack seg-
                ments of the process.

    WCHAN  (-l) An address that uniquely identifies a process within the pro-
                cess table as sleeping until a particular resource becomes
                available; for example, until an I/O request has been com-
                pleted, or in an SXBRK state until more pages of memory are
                available.  This field is blank if the process is running.

    STIME  (-f) The starting time of the process, given in hours, minutes,
                and seconds.  (A process begun more than twenty-four hours
                before ps is executed is given in months and days.)

    TTY         The controling terminal for the process (the message ``?'' is
                printed when there is no controling terminal).
    TIME        The cumulative execution time for the process.

    COMMAND     The name of the command corresponding to the process. The -f
                option prints the full command name and its arguments.  The
                column heading is shortened to CMD for the -l option.

    A process that has exited and has a parent, but has not yet been waited
    for by the parent, is marked <defunct>.

 Notes

    Things can change while ps is running; the snap-shot it gives is only
    true for a split-second, and it may not be accurate by the time you see
    it.  Some data printed for defunct processes is irrelevant.

    If no termlist, proclist, uidlist, or grplist is specified, ps checks
    stdin, stdout, and stderr in that order, looking for the controling ter-
    minal and will attempt to report on processes associated with the con-
    troling terminal.  In this situation, if stdin, stdout, and stderr are
    all redirected, ps will not find a controling terminal, so there will be
    no report.

    On a heavily loaded system, ps may report an lseek(S) error and exit.  ps
    may seek to an invalid user area address:  having obtained the address of
    a process' user area, ps may not be able to seek to that address before
    the process exits and the address becomes invalid.

    ps -ef may not report the actual start of a tty login session, but rather
    an earlier time, when a getty was last respawned on the tty line.

 Authorization

    The behavior of this utility is affected by assignment of the mem author-
    ization. Refer to the ``Using a secure system'' chapter of the User's
    Guide for more details.

 Files

    /dev           terminal (``tty'') names searcher files
    /dev/sxt/*
    /dev/tty*
    /dev/xt/*
    /dev/kmem      kernel virtual memory
    /dev/swap      the default swap device
    /dev/mem       memory
    /etc/passwd    UID information supplier
                   /etc/ps/ps_data internal data structure
    /etc/ps/syms.* list of kernel symbols
    /etc/ps/ttys   list of character special devices
    /etc/ps/uids   list mapping user IDs to user names
    /unix          system name list

 See also

    getty(M), kill(C), nice(C)

 Standards conformance

    ps is conformant with:

    AT&T SVID Issue 2;
    and X/Open Portability Guide, Issue 3, 1989.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026