ps(1)									ps(1)



NAME

  ps - Displays current process status

SYNOPSIS

  ps [-aAdejflm] [-oO specifier][=header],...  [-g glist] [-p plist] [-s
       slist] [-t tlist]
       [-u ulist] [-U ulist] [-n nlist]

  BSD Compatible Syntax

  ps [aAeghjlLmsSTuvwx] [oO specifier][=header],...  [t tty] [process_number]

  The ps command displays the current process status.

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 schedul-
  ing policy.

  Output formats for each process include the process ID (pid), control ter-
  minal 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.

  The state is given by a sequence of letters, for example, RWN.  The first
  letter indicates the status of the process:

  R   Runnable process.

  U   Uninterruptible sleeping process.

  S   Process sleeping for less than about 20 seconds.

  I   Idle (sleeping longer than about 20 seconds) process.

  T   Stopped process.

  H   Halted process.

  Additional characters after these, if any, indicate additional state infor-
  mation:

  W   Process is swapped out (shows a blank space if the process is loaded
      (in-core)).

  >   Process has specified a soft limit on memory requirements and is
      exceeding that limit; such a process is (necessarily) not swapped.

  An additional letter may indicate whether a process is running with altered
  CPU scheduling priority (nice):

  N   Process priority is reduced.

  <   Process priority has been artificially raised.

  +   Process is a process group leader with a controlling tty.

  Format Specifiers

  The following list contains all format specifiers that can be used with ps:

  ____________________________________________________________
  Specifier   Header	Meaning
  ____________________________________________________________
  command     COMMAND

			Command arguments (and environment
			with BSD e flag)
  ucomm	      COMMAND	Command name for accounting
  logname     LOGNAME	User's login name
  flag	      F		Process flags
  status      STATUS	Process status
  uid	      UID	Process user ID (effective UID)
  ruid	      RUID	Process user ID (real UID)
  svuid	      SVUID	Saved process user ID
  rgid	      RGID	Process group (real GID)
  svgid	      SVGID	Saved process group ID
  pid	      PID	Process ID
  ppid	      PPID	Parent process ID
  cp	      CP

			Short-term CPU utilization factor
			(used in scheduling)
  wchan	      WCHAN

			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 sys-
			tem; otherwise, it is printed numeri-
			cally.
  nwchan      WCHAN

			In this case, the initial part of the
			address is trimmed off and is printed
			hexadecimally, for example, 0x80004000
			prints as 4000.
  cursig      CURSIG	Current signal
  sig	      PENDING	Signals pending to this process
  sigmask     BLOCKED	Current signal mask
  sigignore   IGNORED	Signals being ignored
  sigcatch    CAUGHT	Signals being caught
  user	      USER	Username
  ruser	      RUSER	User ID
  group	      GROUP	Group name
  rgroup      RGROUP	Real group name
  pgid	      PGID	Process group ID
  jobc	      JOBC

			Current count of processes qualifying
			PGID for job control
  sess	      SESS	Session ID
  tdev	      TDEV	Major/minor device for controlling tty
  tname	      TT	Controlling tty device name
  longtname   TT	Long controlling tty device name
  tpgid	      TPGID

			Foreground process group associated
			with tty
  tsession    TSESS	Session associated with tty
  state	      S		Symbolic process status
  pri	      PRI

			Process priority
  psxpri      PPR	POSIX scheduling priority
  usrpri      UPR	Base scheduling priority
  nice	      NI

			Process scheduling increment (see the
			setpriority() call).
  vsize	      VSZ	Process virtual address size


  rssize      RSS

			Real memory (resident set) size of the
			process (in 1024 byte units)
  u_procp     UPROCP	Address of process in user area
  umask	      UMASK	Process umask
  acflag      ACFLG	Process accounting flag
  start	      STARTED

			Start time of process.	If start time
			was more than 24 hours ago, gives the
			date.
  lstart      STARTED	Start time and date of process
  cputime     TIME	Current CPU time used
  usertime    USER	Time spent in user space
  systime     SYSTEM	Time spent in system
  pcpu	      %CPU

			Percent CPU usage.  This is a decaying
			average of up to a minute of previous
			(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%.
  pmem	      %MEM	Percent real memory usage
  sl	      SL	Sleep time
  pagein      PAGEIN

			Number of disk I/Os resulting from
			references by the process to pages not
			loaded in core.
  minflt      MINFLT	Page reclaims
  majflt      MAJFLT	Page faults
  nswap	      NSWAP	Swaps
  inblock     INBLK	Block input operations
  oublock     OUBLK	Block output operations
  msgsnd      MSGSND	Messages sent
  msgrcv      MSGRCV	Messages received
  nsignals    NSIGS	Signals received
  nvcsw	      VCSW	Voluntary context switches
  nivcsw      IVCSW	Involuntary context switches
  scount      SCNT	Suspend count
  psr	      PSR	Current processor (~ means bound)
  pset	      PSET	Current processor set (^ means bound)
  policy      POL	Current scheduling policy

  Compound format specifiers are made up of groups of individual format
  specifiers, as follows:

  ___________________________________________________________
  Specifier			   Meaning
  ___________________________________________________________
  RUSAGE

				   minflt, majflt, nswap,
				   inblock, oublock, msgsnd,
				   msgrcv, nsigs, nvcsw,
				   nivcsw
  THREAD

				   user, %cpu, pri, scnt,
				   wchan, usertime, systime
  DFMT (default printing format)

				   pid, tname, state, cpu-
				   time, command
  LFMT (BSD l format)

				   uid, pid, ppid, cp, pri,
				   nice, vsz, rss, wchan,
				   state, tname, cputime,
				   command



  JFMT (j format)

				   user, pid, ppid, pgid,
				   sess, jobc, state, tname,
				   cputime, command



  SFMT (BSD s format)

				   uid, pid, cursig, sig,
				   sigmask, sigignore,
				   sigcatch, stat, tname,
				   command
  VFMT (BSD v format)

				   pid, tt, state, time, sl,
				   pagein, vsz, rss, %cpu,
				   %mem, command
  UFMT (BSD u format)

				   uname, pid, %cpu, %mem,
				   vsz, rss, tt, state,
				   start, time, command
  F5FMT (f format)

				   uname, pid, ppid, %cpu,
				   start, tt, time, command
  L5FMT (l format)

				   f, state, uid, pid, ppid,
				   %cpu, pri, nice, rss,
				   wchan, tt, time, ucomm
  FL5FMT (lf format)

				   f, state, uid, pid, ppid,
				   %cpu, pri, nice, rss,
				   wchan, start, time, com-
				   mand
  process_flags

				   Flags associated with pro-
				   cess as in 
  SCHED

				   user %cpu pri usrpri nice
				   psxpri psr policy pset
  ___________________________________________________________

  The flags associated with process as in  (see process_flags in
  the preceding table) are as follows:

  __________________________________________________________
  Symbolic Constant   Flag Value (Hex)	 Meaning
  __________________________________________________________
  SLOAD		      0x00000001

					 In core
  SSYS		      0x00000002

					 Swapper or pager
					 process
  STRC		      0x00000010

					 Process is being
					 traced
  SOMASK	      0x00000200

					 Restore old mask
					 after taking signal
  SWEXIT	      0x00000400

					 Working on exiting
  SPHYSIO	      0x00000800

					 Doing physical I/O
  SPAGV		      0x00008000

					 Init data space on
					 demand, from vnode
  SSEQL		      0x00010000

					 User warned of
					 sequential vm
					 behavior
  SUANOM	      0x00020000

					 User warned of ran-
					 dom vm behavior
  STIMO		      0x00040000

					 Timing out during
					 sleep
  SOWEUPC	      0x00200000

					 Owe process an
					 addupc() call
  SCTTY		      0x00800000

					 Has a controlling
					 terminal
  SXONLY	      0x02000000

					 Process image
					 read-protected
  SNOCLDSTOP	      0x40000000

					 No SIGCHLD when
					 children stop
  SNOCLDWAIT	      0X20000000

					 No zombies when
					 children exist

  SEXEC		      0x80000000

					 Process called exec
  __________________________________________________________

  
      A process that has exited but whose parent process has not waited for
      it is marked .

  
      A process that is blocked trying to exit is marked .

  The ps program examines memory to get the filename and arguments given when
  the process was created.  The method is inherently somewhat unreliable
  because a process can destroy this information, so the names cannot be
  counted on too much.

FLAGS

  The following flags can be used with ps:

  -a  Prints information to standard output about all processes, except the
      session leaders and processes not associated with a terminal.

  -A  Writes information for all processes.

  -d  Prints information to standard output about all processes, except the
      session leaders.

  -e  Prints information to standard output about all processes.  Equivalent
      to -A.

  -f  Generates a full listing.

  -g glist
      Prints only information about processes that are in the process groups
      listed 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.
      or more spaces (or tabs), or both.  Because of the way the shell treats
      spaces and tabs, you need to quote space-separated lists.

  -G glist
      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.

  -j  Produces job control information, with fields specified for user, pid,
      ppid, pgid, sess, jobc, state, tname, time and command.

  -l  Generates a long listing.

  -m  Prints all threads in a task, if the task has more than one.

  -o specifier[=header],...
      Specifies a list of format specifiers to describe the output format.

  -O specifier[=header],...
      Same as o, except it displays the fields specified by pid, state,
      tname, time, and command in addition to the specifiers supplied on the
      command line.

  -n nlist
      Historically, used to specify an alternative system file name list,
      nlist, in place of the default. The name list concept (see the nlist(3)
      reference page) does not apply to the DEC OSF/1 ps command; conse-
      quently, the -n flag is ignored.

  -p plist
      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.

  -r  Enables warning messages.

  -s slist
      Displays information about processes belonging to the sessions speci-
      fied 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 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.

  -t tlist
      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 " " (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.

      Terminal identifiers must be in one of two forms:

       1.
	The device's filename

       2.
	The device's digit identifier, if the device's filename begins with
	tty

  -u ulist
      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 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.

      In the listing, ps displays the numerical user ID unless the -f flag is
      used; then it displays the login name.

  -U ulist
      Writes information 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.

  The following BSD compatible flags can be used with ps (note that these
  flags are not prefixed with a - (dash) character):

  a   Asks for information regarding processes associated with terminals
      (ordinarily only one's own processes are displayed).

  A   Increases the argument space.

  e   Asks for the environment to be printed, as well as the arguments to the
      command.

  g   Asks for all processes.  Without this flag, ps only prints interesting
      processes.  Processes are deemed to be uninteresting if they are pro-
      cess group leaders.  This normally eliminates top-level command inter-
      preters and processes waiting for users to log in on free terminals.

  h   Repeats the header after each screenful of information.

  j   Produces job control information, with fields specified by user, ppid,
      pgid, sess, and jobc.

  l   Asks for a detailed list, with fields specified by ppid, cp, pri, nice,
      vsize, rssize and wchan.

  L   Lists all available format specifiers.

  m   Prints all threads in a task, if the task has more than one.

  o specifier[=header],...
      Specifies a list of format specifiers to describe the output format.

  O specifier[=header],...
      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.

  s   Gives signal states of the processes, with fields specified by uid,
      cursig, sig, sigmask, sigignore, and sigcatch.

  S   Prints usage summaries (total usage of a command, as opposed to current
      usage).

  ttty
      Lists only processes for the specified tty.

  T   Lists all processes on your tty.

  u   Produces a user oriented output. This includes fields specified by
      user, pcpu, pmem, vsize, rssize, and start.

  v   Produces a version of the output containing virtual memory statistics.
      This includes fields specified by cputime, sl, pagein, vsize, rssize,
      pcpu, and pmem.

  w   Uses a wide output format (132 columns (bytes) rather than 80); if this
      flag is doubled (ww), uses an arbitrarily wide output.  This informa-
      tion determines how much of long commands to print.

  x   Asks even about processes with no terminal.

  process_number
      Restricts output to the specified process.  This argument must be
      entered last on the command line.

NOTES

  The following BSD compatible flags are not supported.	 (You can reconstruct
  the output of these flags by using the appropriate format specifiers, how-
  ever.)

  c   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.

  n   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.

RESTRICTIONS

  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
   state after they have exited.  Processes in this state cannot be
  killed until the process that forked them is killed.

  The system puts exiting child processes in the  state if their
  parent process is still running and has not caught the SIGCHLD signal or
  executed a wait() system call.

  To avoid having users encounter this problem when they run your applica-
  tion, make sure that your program logic either catches the SIGCHLD signal
  or executes a wait() system call when spawning a child process.

EXAMPLES

   1.  To list all your processes, enter:
	    ps


   2.  To list all processes, enter:
	    ps	-A


       The BSD equivalent looks like this:
	    ps ax


   3.  To list processes owned by specific users, enter:
	    ps	-f  -l	-ujim,jane,su


   4.  To list processes associated with a specific tty, enter:
	    ps	-t console


       The BSD equivalent looks like this:
	    ps tco


   5.  To display only the pid, user, and comm information for all processes,
       enter:
	    ps -o pid,user,comm -A


   6.  To display the parent process ID under the header PARENT, as well as
       the default headers (fields specified by pid, state, tname, time, com-
       mand), enter:
	    ps -O ppid=PARENT


   7.  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 default
       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 exclusively (^) to pro-
       cessor set 2. And processes 579, 580, and 581 are running bound to
       processor 1 (~) and are bound exclusively to processor set 2 (^).

FILES

  /dev	 Searched to find tty names.

RELATED INFORMATION

  Commands: kill(1), w(1), runon(1)
  Routines: sched_setscheduler(3), pthread_setscheduler(3)
  File Formats: processor_sets(4)