ps - report process status, gives a snapshot of the current processes.

SIMPLE PROCESS SELECTION

       -A           all 
       -a           all with a tty except session leaders
       -d           all,omit session leaders
       -e           all processes
        T            all on this terminal
        a            all processes on a terminal,  including those of other users
        g            really all, even group leaders (does nothing w/o SunOS settings)
        r            only running processes
        x            select processes without controlling ttys
       -N, --deselect   negate selection

PROCESS SELECTION BY LIST

       -u,--user     effective user name or ID     -g,--group    effective group name/ ID
       U,-U,--User   real user name/ID             -G,--Group    real group name/ID

       123       implied --pid
       p,-p,--pid      process ID

       -123      implied --sid
       --sid      session ID
       -s        select processes belonging to the sessions given

       t,-t,--tty      terminal

       -C         command name

OUTPUT FORMAT CONTROL

       -f         full listing
       -y         do not show flags; show rss in place of addr
       O,O        is preloaded "o" (overloaded)
       j,-j       job control 
       l,-l       long 
       -c         different scheduler info for -l option
       s          signal 
       u          user-oriented 
       v          virtual memory 
       o,-o,--format user-defined 
       X          old Linux i386 register format
   

OUTPUT MODIFIERS

       -m             all threads
       -n,N           set namelist file
       C              use raw CPU time for %CPU instead of decaying average
       c              true command name
       e              show environment after the command
       n              numeric output for WCHAN and USER
       -w,w             wide output
       --cols,--columns,--width        set screen width
       S,--cumulative   include some dead child process data (as a  sum  with the parent)
       -H             process hierarchy (forest)
       f,--forest     ASCII art process tree
       --html         HTML escaped output
       --headers      repeat header lines
       h,--no-headers   print no header line at all
       --rows,--lines        set screen height
       O,--sort         sorting order
       --nul,--null,--zero unjustified output with NULs

INFORMATION

       L           list all format specifiers
       --help      print help message
       --info      print debugging info
       V,-V,--version   print version

Notes

-g can select by session leader OR by group name. Selection by session leader is specified by many standards, but selection by group is the logical behavior that several other operating systems use. This ps will select by session leader when the list is completely numeric (as sessions are). Group ID numbers will work only when some group names are also specified.

Terminals (ttys, or screens of text output) can be specified as:

.

sorting:i O[+|-]k1[,[+|-]k2[,...]]
Order the process listing according to the multilevel sort specified by the sequence of short keys from SORT KEYS, k1, k2, ... The O must be the last option in a single command argument, but specifications in successive arguments are catenated.

--sortX[+|-]key[,[+|-]key[,...]]

To produce the WCHAN field, ps needs to read the System.map file created when the kernel is compiled. The search path is:

              $PS_SYSTEM_MAP
              /boot/System.map-'uname -r'
              /boot/System.map
              /lib/modules/'uname -r'/System.map
              /usr/src/linux/System.map
              /System.map
Programs swapped out will be shown without command line arguments, and unless the c option is given, in brackets.

%CPU shows the cputime/realtime percentage.

The SIZE and RSS fields don't count the page tables and the task_struct of a proc; this is at least 12k of memory that is always resident. SIZE is the virtual size of the proc (code+data+stack).

Processes marked are dead processes (so-called "zombies") that remain because their parent has not destroyed them properly. These processes will be destroyed by init(8) if the parent process exits.

PROCESS FLAGS FORKNOEXEC 1 forked but didn't exec SUPERPRIV 2 used super-user privileges DUMPCORE 4 dumped core

PROCESS STATE CODES D uninterruptible sleep (usually IO) R runnable (on run queue) S sleeping T traced or stopped Z a defunct ("zombie") process

For BSD formats and when the "stat" keyword is used, additional letters may be displayed:

W has no resident pages < high-priority process N low-priority task L has pages locked into memory (for real-time and custom IO)

SORT KEYS Note that the values used in sorting are the internal values ps uses and not the 'cooked' values used in some of the output format fields. Pipe ps output into the sort(1) command if you want to sort the cooked values.

       KEY   LONG         DESCRIPTION
       c     cmd          simple name of executable
       C     cmdline      full command line
       f     flags        flags as in long format F field
       g     pgrp         process group ID
       G     tpgid        controlling tty process group ID
       j     cutime       cumulative user time
       J     cstime       cumulative system time
       k     utime        user time
       K     stime        system time
       m     min_flt      number of minor page faults
       M     maj_flt      number of major page faults
       n     cmin_flt     cumulative minor page faults
       N     cmaj_flt     cumulative major page faults
       o     session      session ID
       p     pid          process ID
       P     ppid         parent process ID
       r     rss          resident set size
       R     resident     resident pages
       s     size         memory size in kilobytes
       S     share        amount of shared pages
       t     tty          the minor device number of tty
       T     start_time   time process was started
       U     uid          user ID number
       u     user         user name
       v     vsize        total VM size in bytes
       y     priority     kernel scheduling priority

AIX FORMAT DESCRIPTORS

This ps supports AIX format descriptors, which work somewhat like the formatting codes of printf(1) and printf(3). For example, the normal default output can be produced with this: ps -eo "%p %y %x %c"
      CODE   NORMAL   HEADER         CODE   NORMAL   HEADER
       %C     pcpu     %CPU
       %U     user     USER          %u     ruser    RUSER
       %G     group    GROUP         %g     rgroup   RGROUP
       %a     args     COMMAND       %c     comm     COMMAND
       %p     pid      PID           %P     ppid     PPID
       %r     pgid     PGID
       %n     nice     NI
       %t     etime    ELAPSED       %x     time     TIME
       %y     tty      TTY
       %z     vsz      VSZ
       
   

STANDARD FORMAT SPECIFIERS

used to control both output format and sorting. For example:
    ps -eo pid,user,args --sort user
       %cpu          %CPU            %mem          %MEM
       alarm         ALARM
       args          COMMAND
       blocked       BLOCKED
       bsdstart      START
       bsdtime       TIME
       c             C
       caught        CAUGHT
       cp            CP
       cpu           CPU
       cmd           CMD
       comm          COMMAND         command       COMMAND
       drs           DRS
       dsiz          DSIZ
       euid          EUID            fsuid         FSUID
       ruid          RUID
       fuser         FUSER           fsuser        FSUSER    euser         EUSER           
       ruser         RUSER
       fgid          FGID            fsgid         FSGID     egid          EGID
       fgroup        FGROUP          fsgroup       FSGROUP   egroup        EGROUP          
       eip           EIP
       esp           ESP
       cputime       TIME            etime         ELAPSED
       f             F
       flag          F
       flags         F
       fname         COMMAND
       fuid          FUID
       suid          SUID uid           UID      svuid         SVUID
       uid_hack      UID
       uname         USER user          USER suser         SUSER
       gid           GID pgid          PGID pgrp          PGRP
       group         GROUP
       svgid         SVGID svgroup       SVGROUP
       rgid          RGID
       rgroup        RGROUP

       pid           PID                ppid          PPID
       ignored       IGNORED
       intpri        PRI
       lim           LIM
       longtname     TTY
       lstart        STARTED
       m_drs         DRS             m_trs         TRS
       maj_flt       MAJFL           majflt        MAJFLT
       min_flt       MINFL           minflt        MINFLT
       ni            NI              nice          NI
       nwchan        WCHAN
       opri          PRI
       pagein        PAGEIN
       pcpu          %CPU
       pending       PENDING
       pmem          %MEM
       policy        POL
       pri           PRI
       rss           RSS             rssize        RSS
       rsz           RSZ
       rtprio        RTPRIO
       s             S
       sess          SESS            session       SESS
       sgi_p         P
       sgi_rss       RSS
       sgid          SGID
       sgroup        SGROUP
       sid           SID
       sig           PENDING
       sig_block     BLOCKED         sig_catch     CATCHED
       sigmask       BLOCKED
       sig_ignore    IGNORED         sig_pend      SIGNAL
       sigcatch      CAUGHT          sigignore     IGNORED
       start         STARTED
       start_stack   STACKP          stackp        STACKP
       start_time    START
       stat          STAT
       state         S
       stime         STIME
       svuser        SVUSER
       sz            SZ
       time          TIME
       timeout       TMOUT
       tmout         TMOUT
       tname         TTY
       tpgid         TPGID
       trs           TRS             trss          TRSS
       tsiz          TSIZ
       tt            TT              tty           TT
       tty4          TTY             tty8          TTY
       ucomm         COMMAND
       vsize         VSZ
       vsz           VSZ
       wchan         WCHAN
   

ENVIRONMENT VARIABLES

The following environment variables could affect ps:

COLUMNS Override default display width LINES Override default display height PS_PERSONALITY Set to one of posix,old,linux,bsd,sun,digital CMD_ENV Set to one of posix,old,linux,bsd,sun,digital I_WANT_A_BROKEN_PS Force obsolete command line interpretation LC_TIME Date format PS_FORMAT Default output format override PS_SYSMAP Default namelist (System.map) location PS_SYSTEM_MAP Default namelist (System.map) location POSIXLY_CORRECT Don't find excuses to ignore bad "features" UNIX95 Don't find excuses to ignore bad "features" _XPG Cancel CMD_ENV=irix non-standard behavior

In general, it is a bad idea to set these variables. The two exceptions are CMD_ENV (or PS_PERSONALITY), to set the desired default personality, and POSIXLY_CORRECT (or UNIX95), which should be set for Unix98 standard compliance.

PS_PERSONALITY Description

       none             "Do the right thing"
       aix              AIX             bsd              FreeBSD 
       compaq           Digital Unix    debian           the old Debian 
       digital          Digital Unix 
       gnu              the old Debian 
       hp               HP-UX           hpux             HP-UX 
       irix             Irix 
       linux            deviate from Unix98 for convenience only
       old              the original Linux 
       sco              SCO             sgi              Irix 
       sun              SunOS 4         sunos            SunOS 4 
       posix            standard
       sysv, unix, unix95, unix98

EXAMPLES

To see every process on the system using standard syntax: ps -e To see every process on the system using BSD syntax: ps ax To see every process except those running as root (real & effective ID) ps -U root -u root -N To see every process with a user-defined format: ps -eo pid,tt,user,fname,tmout,f,wchan Odd display with AIX field descriptors: ps -o "%u : %U : %p : %a" Print only the process IDs of syslogd: ps -C syslogd -o pid=

SEE ALSO

top(1) pstree(1) proc(5)

Please send bug reports to