*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: ps | Section: 1 | Source: Digital UNIX | File: ps.1.gz
ps(1) General Commands Manual ps(1) NAME ps - Displays current process status SYNOPSIS Current XPG4-UNIX Syntax ps [-aAdejflm] [-o specifier][=header],... [-O specifier][=header],... [-g glist] [-G glist] [-p plist] [-s slist] [-t tlist] [-u ulist] [-U ulist] [-n nlist] BSD Compatible Syntax ps [aAeghjlLmsSTuvwx] [o specifier][=header],... [O speci- fier][=header],... [t tty] [process_number] The ps command displays the current process status. STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: ps: XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. OPTIONS Current Syntax The following options can be used with ps: Prints information to stan- dard output about all processes, except the session leaders and processes not associated with a terminal. Writes information for all processes. Prints information to standard output about all processes, except the session leaders. Prints information to standard output about all processes. Equivalent to -A. Generates a full listing. Prints only information about processes that are in the process groups listed in glist. The glist is a list of process-group identifiers en- closed in " " (double quotes) and separated from one another by a comma or one or more spaces (or tabs), or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. Writes information for processes whose real group ID numbers or names are given in glist. The glist is a list of process-group identifiers enclosed in " " (double quotes) and separated from one another by a comma or one or more spaces (or tabs), or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. [DIGITAL] Produces job control information, with fields specified for user, pid, ppid, pgid, sess, jobc, state, tname, time and command. Generates a long listing. [DIGITAL] Prints all threads in a task, if the task has more than one. Specifies a list of format specifiers to describe the output format. Multiple -o options may be specified. The final output is a concatenation of all options specified. [DIGITAL] If the -O option is used with one or more -o options, the -O option must appear first on the command line. [DIGI- TAL] Same as the -o option, except it displays the fields spec- ified by pid, state, tname, time, and command in addition to the specifiers supplied on the command line. [DIGITAL] The -O option may be used with one or more -o op- tions. The result is a concatenated output. The -O option must be specified first. Historically, used to specify an alterna- tive system file name list, nlist, in place of the default. [DIGITAL] The name list concept (see the nlist(3) reference page) does not apply to the DIGITAL UNIX ps command; conse- quently, the -n option is ignored. Displays only information about processes with the process numbers specified in plist. The plist argument is either a list of process ID numbers or a list of process ID numbers enclosed in " " (double quotes) and separated from one another by a comma or one or more spaces (or tabs), or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. [DIGITAL] En- ables warning messages. [DIGITAL] Displays information about processes belonging to the sessions specified in slist. The slist argument is either a list of session ID numbers or a list of session ID numbers enclosed in " " (double quotes) and sepa- rated from one another by a comma or one or more spaces (or tabs), or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. Displays only information about processes associated with the terminals listed in tlist. The tlist argument is either a list of terminal iden- tifiers or a list of terminal identifiers enclosed in " " (dou- ble quotes) and separated from one another by a comma or one or more spaces, or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. Terminal identifiers must be in one of two forms: The device's file name The device's digit identifier, if the device's file name begins with tty Displays only information about processes with the user ID numbers or login names specified in ulist. The ulist argument is either a list of user IDs or a list of user IDs enclosed in " " (double quotes) and separated from one an- other by a comma or one or more spaces, or both. Because of the way the shell treats spaces and tabs, you need to quote space- separated lists. In the listing, ps displays the numerical user ID unless the -f option is used; then it displays the login name. Writes infor- mation for processes whose real user ID numbers or login names are given in ulist. The ulist argument is either a list of user IDs or a list of user IDs enclosed in " " (double quotes) and separated from one another by a comma or one or more spaces, or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. BSD Compatible Syntax [DIGITAL] The following BSD compatible options can be used with ps (note that these options are not prefixed with a - (dash) character): [DIGITAL] Asks for information regarding processes associated with terminals (ordinarily only one's own processes are displayed). [DIGI- TAL] Increases the argument space. [DIGITAL] Asks for the environ- ment to be printed, as well as the arguments to the command. [DIGI- TAL] Asks for all processes. Without this option, ps only prints in- teresting processes. Processes are deemed to be uninteresting if they are process group leaders. This normally eliminates top-level command interpreters and processes waiting for users to log in on free termi- nals. [DIGITAL] Repeats the header after each screenful of informa- tion. [DIGITAL] Produces job control information, with fields speci- fied by user, ppid, pgid, sess, and jobc. [DIGITAL] Asks for a de- tailed list, with fields specified by ppid, cp, pri, nice, vsize, rs- size and wchan. [DIGITAL] Lists all available format specifiers. [DIGITAL] Prints all threads in a task, if the task has more than one. [DIGITAL] Specifies a list of format specifiers to describe the output format. [DIGITAL] Same as o, except it displays the fields specified by pid, state, tname, cputime, and comm in addition to the specifiers supplied on the command line. [DIGITAL] Gives signal states of the processes, with fields specified by uid, cursig, sig, sigmask, sigig- nore, and sigcatch. [DIGITAL] Prints usage summaries (total usage of a command, as opposed to current usage). [DIGITAL] Lists only processes for the specified terminal. [DIGITAL] Lists all processes on your terminal. [DIGITAL] Produces a user oriented output. This in- cludes fields specified by user, pcpu, pmem, vsize, rssize, and start. [DIGITAL] Produces a version of the output containing virtual memory statistics. This includes fields specified by cputime, sl, pagein, vsize, rssize, pcpu, and pmem. [DIGITAL] Uses a wide output format (132 columns (bytes) rather than 80); if this option is doubled (ww), uses an arbitrarily wide output. This information determines how much of long commands to print. [DIGITAL] Asks even about processes with no terminal. OPERANDS Current Syntax None BSD Compatible Syntax [DIGITAL] Restricts output to the specified process. This argument must be entered last on the command line. DESCRIPTION While ps is a fairly accurate snapshot of the system, ps cannot begin and finish a snapshot as fast as some processes change state. At times there may be minor discrepancies. The ps command can be used on multiprocessing systems and for querying the system state of realtime applications for their POSIX priority and scheduling policy. Output formats for each process include the process ID (pid), control terminal of the process (tname), CPU time used by the process (cputime) (this includes both user and system time), the state of the process (state), and an indication of the command that is running (command). The abbreviation tty indicates a terminal. [DIGITAL] The state is given by a sequence of letters, for example, RWN. The first letter indicates the status of the process: [DIGI- TAL] Runnable process. [DIGITAL] Uninterruptible sleeping process. [DIGITAL] Process sleeping for less than about 20 seconds. [DIGI- TAL] Idle (sleeping longer than about 20 seconds) process. [DIGI- TAL] Stopped process. [DIGITAL] Halted process. [DIGITAL] Additional characters after these, if any, indicate addi- tional state information: [DIGITAL] Process is swapped out (shows a blank space if the process is loaded (in-core)). [DIGITAL] Process has specified a soft limit on memory requirements and is exceeding that limit; such a process is (necessarily) not swapped. [DIGITAL] An additional letter may indicate whether a process is run- ning with altered CPU scheduling priority (nice): [DIGITAL] Process priority is reduced. [DIGITAL] Process priority has been artificially raised. [DIGITAL] Process is a process group leader with a control- ling terminal. Format Specifiers The following list contains all format specifiers that can be used with ps: l l lw(4.2i). _ Specifier Header Meaning _ acflag ACFLG T{ [DIGITAL] Process accounting flag T} args COMMAND Command arguments c C CPU utilization factor for scheduling cmd CMD T{ [DIGI- TAL] Command arguments T} comm COMMAND Command name for accounting command COMMAND T{ [DIGITAL] Command arguments (and environment with BSD e option) T} cp CP T{ [DIGITAL] Short-term CPU utiliza- tion factor (used in scheduling) T} cputime TIME T{ [DIGITAL] Cur- rent CPU time used T} cursig CURSIG T{ [DIGITAL] Current signal T} etime ELAPSED Time command has been running flag F [DIGI- TAL] Process flags group GROUP Group name inblock IN- BLK T{ [DIGITAL] Block input operations T} jobc JOBC T{ [DIGI- TAL] Current count of processes qualifying PGID for job control T} logname LOGNAME T{ [DIGITAL] User's login name T} longt- name TTY T{ [DIGITAL] Long controlling terminal device name T} lstart STARTED T{ [DIGITAL] Start date and time of process T} ma- jflt MAJFLT [DIGITAL] Page faults minflt MINFLT [DIGI- TAL] Page reclaims msgrcv MSGRCV T{ [DIGITAL] Messages received T} msgsnd MSGSND [DIGITAL] Messages sent nice NI T{ Process scheduling increment (see the setpriority() call). T} nivcsw IVCSW T{ [DIGITAL] Involuntary context switches T} nsignals NSIGS T{ [DIGITAL] Signals received T} nswap NSWAP [DIGITAL] Swaps nvcsw VCSW T{ [DIGITAL] Vol- untary context switches T} nwchan WCHAN T{ [DIGITAL] Address of event on which a process is waiting (an address in the system). In this case, the initial part of the address is trimmed off and is printed hexadecimally, for example, 0x80004000 prints as 4000. T} ou- block OUBLK T{ [DIGITAL] Block output operations T} pagein PAGEIN T{ [DIGITAL] Number of disk I/Os resulting from references by the process to pages not loaded in core. T} pcpu %CPU T{ Percent CPU usage. This is a decaying average of up to a minute of pre- vious (real) time. Since the time base over which this is computed varies (since processes may be very young), it is possible for the sum of all %CPU fields to exceed 100%. T} pgid PGID Process group ID pid PID Process ID pmem %MEM T{ [DIGITAL] Percent real memory usage T} policy POL T{ [DIGITAL] Current scheduling policy T} ppid PPID Parent process ID pri PRI T{ [DIGITAL] Process priority T} pset PSET T{ [DIGITAL] Current processor set (^ means bound) T} psr PSR T{ [DIGITAL] Current processor (~ means bound) T} psx- pri PPR T{ [DIGITAL] POSIX scheduling priority T} rgid RGID T{ [DIGITAL] Process group (real GID) T} rgroup RGROUP Real group name rssize RSS T{ [DIGITAL] Real memory (resident set) size of the process (in 1024 byte units) T} ruid RUID T{ [DIGITAL] Process user ID (real UID) T} ruser RUSER User ID scount SCNT [DIGI- TAL] Suspend count sess SESS [DIGITAL] Session ID sig PENDING T{ [DIGITAL] Signals pending to this process T} sigcatch CAUGHT T{ [DIGITAL] Signals being caught T} sigignore IGNORED T{ [DIGI- TAL] Signals being ignored T} sigmask BLOCKED T{ [DIGITAL] Cur- rent signal mask T} sl SL [DIGITAL] Sleep time start STARTED T{ [DIGITAL] Start time of process. If start time was more than 24 hours ago, gives the date. T} state S T{ [DIG- ITAL] Symbolic process status T} status STATUS T{ [DIGI- TAL] Process status T} stime STARTED T{ Start time of process. If start time was more than 24 hours ago, gives the date. T} svgid SVGID T{ [DIGITAL] Saved process group ID T} svuid SVUID T{ [DIGITAL] Saved process user ID T} sys- time SYSTEM T{ [DIGITAL] Time spent in system T} tdev TDEV T{ [DIGITAL] Major/minor device for controlling terminal T} time TIME Current CPU time used tname TTY T{ [DIGITAL] Control- ling terminal device name T} tpgid TPGID T{ [DIGITAL] Fore- ground process group associated with terminal T} tsession TSESS T{ [DIGITAL] Session associated with terminal T} tt TTY Controlling terminal device name tty TTY Controlling terminal device name ucomm COMMAND T{ [DIGITAL] Command name for accounting T} uid UID T{ [DIGITAL] Process user ID (effective UID) T} umask UMASK [DIGITAL] Process umask user USER Username user- time USER T{ [DIGITAL] Time spent in user space T} usrpri UPR T{ [DIGITAL] Base scheduling priority T} u_procp UPROCP T{ [DIGI- TAL] Address of process in user area T} vsize VSZ T{ [DIGI- TAL] Process virtual address size T} vsz VSZ Process virtual address size wchan WCHAN T{ [DIGITAL] Address of event on which a process is waiting (an address in the system). A symbol is chosen that classifies the address, if available, from the system; otherwise, it is printed numerically. T} _ Compound Format Specifiers [DIGITAL] Compound format specifiers are made up of groups of individ- ual format specifiers, as follows: lw(3.7i) lw(3.7i). _ Specifier Meaning _ RUSAGE T{ [DIGITAL] min- flt, majflt, nswap, inblock, oublock, msgsnd, msgrcv, nsigs, nvcsw, nivcsw T} THREAD T{ [DIGITAL] user, pcpu, pri, scnt, wchan, user- time, systime T} T{ DFMT (default printing format) T} T{ [DIGI- TAL] pid, tname, state, cputime, command T} T{ LFMT (BSD l format) T} T{ [DIGITAL] uid, pid, ppid, cp, pri, nice, vsz, rss, wchan, state, tname, cputime, command T} JFMT (j format) T{ [DIGI- TAL] user, pid, ppid, pgid, sess, jobc, state, tname, cputime, command T} T{ SFMT (BSD s format) T} T{ [DIGITAL] uid, pid, cursig, sig, sigmask, sigignore, sigcatch, stat, tname, command T} T{ VFMT (BSD v format) T} T{ [DIGITAL] pid, tt, state, time, sl, pagein, vsz, rss, pcpu, pmem, command T} T{ UFMT (BSD u format) T} T{ [DIGITAL] uname, pid, pcpu, pmem, vsz, rss, tt, state, start, time, command T} F5FMT (f format) T{ [DIGITAL] uname, pid, ppid, pcpu, start, tt, time, com- mand T} L5FMT (l format) T{ [DIGITAL] f, state, uid, pid, ppid, pcpu, pri, nice, rss, wchan, tt, time, ucomm T} FL5FMT (lf format) T{ [DIGITAL] f, state, uid, pid, ppid, pcpu, pri, nice, rss, wchan, start, time, command T} SCHED T{ [DIGITAL] user, pcpu, pri, usr- pri, nice, psxpri, psr, policy, pset T} _ Process Flags The flags associated with process in <sys/proc.h> are as follows: lw(1.4i) l lw(4.1i). _ T{ Symbolic Constant T} Flag Value Mean- ing _ SLOAD 0x00000001 In core SSYS 0x00000002 T{ [DIGI- TAL] Swapper or pager process T} SLOMAP 0x00000004 Process al- lowed to use low virtual memory SNOTASK 0x00000040 Process com- pleted exit SWWAIT 0x00000080 Thread is removing zombie SO- MASK 0x00000200 Restore old mask after taking signal SWEXIT 0x00000400 Working on exiting SPHYSIO 0x00000800 Doing physical I/O SVFORK 0x00001000 T{ Process resulted from vfork() T} SPAGV 0x00008000 Init data space on demand, from vnode SSEQL 0x00010000 User warned of se- quential vm behavior SUANOM 0x00020000 User warned of random vm behavior SCONTIGN 0x00040000 Process is ignoring SIGCONT S1170 0X00080000 T{ Process is using Single UNIX(R) Specifica- tion signal behaviors T} SLOGIN 0x00400000 T{ Process marked as a login for Capacity Limitation T} SCTTY 0x00800000 Process has a controlling terminal SXONLY 0x02000000 Process image read-pro- tected SAIO 0x08000000 Process performed asynchronous I/O SNOCLD- WAIT 0x20000000 No zombies when children exist SNOCLD- STOP 0x40000000 T{ No SIGCHLD when children stop T} SEXEC 0x80000000 Process called exec _ A process that has exited but whose parent process has not waited for it. [DIGITAL] A process for which user area information could not be obtained due to a shortage of system memory. A process that is blocked trying to exit. NOTES [DIGITAL] The following BSD compatible options are not supported. (You can reconstruct the output of these options by using the appropri- ate format specifiers, however.) [DIGITAL] Displays the command name, as stored internally in the system for purposes of accounting, rather than the command arguments, which are kept in the process's address space. [DIGITAL] Displays numeric output. In a long listing, the wchan field is printed numerically rather than symbolically. In a user listing, the user field is replaced by a uid field. The arguments dis- played by args and command format specifiers reflect the arguments passed to the command at its invocation. Any modification made to the arguments by the running command are not available. The arguments dis- played by args and command format specifiers are the only output fields that contain embedded blanks, which may be a concern if the output is passed to some type of parser. Since output fields appear in the order of the format specifiers on the command line, you should put these specifiers at the end of the command if you are using a parser to ana- lyze the output. RESTRICTIONS [DIGITAL] When you enter a ps command while running an application that forks child processes, you might see some child processes listed as being in the <defunct> state after they have exited. Processes in this state cannot be killed until the process that forked them is killed. [DIGITAL] The system puts exiting child processes in the <de- funct> state if their parent process is still running and has not caught the SIGCHLD signal or executed a wait() system call. [DIGITAL] To avoid having users encounter this problem when they run your application, make sure that your program logic ei- ther catches the SIGCHLD signal or executes a wait() system call when spawning a child process. [DIGITAL] It is an error to use two format specifiers, such as comm and ucomm or command and args that are really synonyms for the same output request. [DIGITAL] It is an error to use two or more compound format specifiers that contain the same simple format specifier, or to use a simple format specifier with a compound format specifier that includes the simple specifier. EXIT STATUS The following exit values are returned: Successful completion. An er- ror occurred. EXAMPLES To list all your processes, enter: ps To list all processes, enter: ps -A The BSD equivalent looks like this: ps ax To list processes owned by specific users, enter: ps -f -l -ujim,jane,su To list processes associated with a specific terminal, enter: ps -t con- sole The BSD equivalent looks like this: ps tco To display only the pid, user, and comm information for all processes, enter: ps -o pid,user,comm -A To display the parent process ID under the header PARENT, as well as the default headers (fields specified by pid, state, tname, time, command), enter: ps -O ppid=PARENT The following ps command shows the use of the SCHED specifier on a two-processor system with two processor sets: ps -O SCHED PID USER %CPU PRI UPR NI PPR PSR POL PSET S TTY TIME COM 458 root 0.0 43 44 0 20 0 TS 0 I + console 0:01.34 csh 561 root 0.0 44 44 0 19 0 TS 0 I ttyp0 0:00.42 csh 567 root 0.0 44 44 0 19 1 TS ^2 I ttyp0 0:00.03 runon 568 root 0.0 44 44 0 19 1 TS ^2 I ttyp0 0:00.03 sh 569 root 0.0 44 44 0 19 1 TS ^2 S ttyp0 0:00.31 csh 579 root 0.0 44 44 0 19 ~1 TS ^2 S + ttyp0 0:00.03 runon 580 root 0.0 44 44 0 19 ~1 TS ^2 S + ttyp0 0:00.03 sh 581 root 0.0 44 44 0 19 ~1 TS ^2 R + ttyp0 0:00.06 ls -l The display shows that all processes are running under the de- fault timershare scheduling policy. Processes 458 and 561 are running unbound to processor 0 in processor set 0. Processes 567, 568, and 569, are running on processor 1 and are bound ex- clusively (^) to processor set 2. Processes 579, 580, and 581 are running bound to processor 1 (~) and are bound exclusively to processor set 2 (^). To display the name of the shell you are currently running, enter: ps -p $$ ENVIRONMENT VARIABLES The following environment variables affect the execution of ps: Over- rides the horizontal screen size, used to determine the number of text columns to display. Provides a default value for the internationaliza- tion variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the in- ternationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non- empty string value, overrides the values of all the other internation- alization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the lo- cale for the format and contents of diagnostic messages written to standard error. Determines the format and contents of the date and time strings displayed. Determines the location of message catalogues for the processing of LC_MESSAGES. FILES Searched to find terminal names. Process information. SEE ALSO Commands: kill(1), nice(1), renice(8), runon(1), w(1) Functions: exit(2), fork(2), getpriority(2), exec(2), wait(2) Routines: nlist(3), sched_setscheduler(3) Files: processor_sets(4) Standards: standards(5) ps(1)

Navigation Options