3
0

ps.posix 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. This is what POSIX 2003 says about ps:
  2. By default, ps shall select all processes with the same effective user
  3. ID as the current user and the same controlling terminal as the invoker
  4. ps [-aA][-defl][-G grouplist][-o format]...[-p proclist][-t termlist]
  5. [-U userlist][-g grouplist][-n namelist][-u userlist]
  6. -a Write information for all processes associated with terminals.
  7. Implementations may omit session leaders from this list.
  8. -A Write information for all processes.
  9. -d Write information for all processes, except session leaders.
  10. -e Write information for all processes. (Equivalent to -A.)
  11. -f Generate a full listing. (See the STDOUT section for the con-
  12. tents of a full listing.)
  13. -g grouplist
  14. Write information for processes whose session leaders are given
  15. in grouplist. The application shall ensure that the grouplist is
  16. a single argument in the form of a <blank> or comma-separated
  17. list.
  18. -G grouplist
  19. Write information for processes whose real group ID numbers are
  20. given in grouplist. The application shall ensure that the grou-
  21. plist is a single argument in the form of a <blank> or comma-
  22. separated list.
  23. -l Generate a long listing. (See STDOUT for the contents of a long
  24. listing.)
  25. -n namelist
  26. Specify the name of an alternative system namelist file in place
  27. of the default. The name of the default file and the format of a
  28. namelist file are unspecified.
  29. -o format
  30. Write information according to the format specification given in
  31. format. Multiple -o options can be specified; the format speci-
  32. fication shall be interpreted as the <space>-separated concate-
  33. nation of all the format option-arguments.
  34. -p proclist
  35. Write information for processes whose process ID numbers are
  36. given in proclist. The application shall ensure that the pro-
  37. clist is a single argument in the form of a <blank> or comma-
  38. separated list.
  39. -t termlist
  40. Write information for processes associated with terminals given
  41. in termlist. The application shall ensure that the termlist is a
  42. single argument in the form of a <blank> or comma-separated
  43. list. Terminal identifiers shall be given in an implementation-
  44. defined format. On XSI-conformant systems, they shall be
  45. given in one of two forms: the device's filename (for example,
  46. tty04) or, if the device's filename starts with tty, just the
  47. identifier following the characters tty (for example, "04" ).
  48. -u userlist
  49. Write information for processes whose user ID numbers or login
  50. names are given in userlist. The application shall ensure that
  51. the userlist is a single argument in the form of a <blank> or
  52. comma-separated list. In the listing, the numerical user ID
  53. shall be written unless the -f option is used, in which case the
  54. login name shall be written.
  55. -U userlist
  56. Write information for processes whose real user ID numbers or
  57. login names are given in userlist. The application shall ensure
  58. that the userlist is a single argument in the form of a <blank>
  59. or comma-separated list.
  60. With the exception of -o format, all of the options shown are used to
  61. select processes. If any are specified, the default list shall be
  62. ignored and ps shall select the processes represented by the inclusive
  63. OR of all the selection-criteria options.
  64. The -o option allows the output format to be specified under user con-
  65. trol.
  66. The application shall ensure that the format specification is a list of
  67. names presented as a single argument, <blank> or comma-separated. Each
  68. variable has a default header. The default header can be overridden by
  69. appending an equals sign and the new text of the header. The rest of
  70. the characters in the argument shall be used as the header text. The
  71. fields specified shall be written in the order specified on the command
  72. line, and should be arranged in columns in the output. The field widths
  73. shall be selected by the system to be at least as wide as the header
  74. text (default or overridden value). If the header text is null, such as
  75. -o user=, the field width shall be at least as wide as the default
  76. header text. If all header text fields are null, no header line shall
  77. be written.
  78. ruser The real user ID of the process. This shall be the textual user
  79. ID, if it can be obtained and the field width permits, or a dec-
  80. imal representation otherwise.
  81. user The effective user ID of the process. This shall be the textual
  82. user ID, if it can be obtained and the field width permits, or a
  83. decimal representation otherwise.
  84. rgroup The real group ID of the process. This shall be the textual
  85. group ID, if it can be obtained and the field width permits, or
  86. a decimal representation otherwise.
  87. group The effective group ID of the process. This shall be the textual
  88. group ID, if it can be obtained and the field width permits, or
  89. a decimal representation otherwise.
  90. pid The decimal value of the process ID.
  91. ppid The decimal value of the parent process ID.
  92. pgid The decimal value of the process group ID.
  93. pcpu The ratio of CPU time used recently to CPU time available in the
  94. same period, expressed as a percentage. The meaning of
  95. "recently" in this context is unspecified. The CPU time avail-
  96. able is determined in an unspecified manner.
  97. vsz The size of the process in (virtual) memory in 1024 byte units
  98. as a decimal integer.
  99. nice The decimal value of the nice value of the process; see nice() .
  100. etime In the POSIX locale, the elapsed time since the process was
  101. started, in the form: [[dd-]hh:]mm:ss
  102. time In the POSIX locale, the cumulative CPU time of the process in
  103. the form: [dd-]hh:mm:ss
  104. tty The name of the controlling terminal of the process (if any) in
  105. the same format used by the who utility.
  106. comm The name of the command being executed ( argv[0] value) as a
  107. string.
  108. args The command with all its arguments as a string. The implementa-
  109. tion may truncate this value to the field width; it is implemen-
  110. tation-defined whether any further truncation occurs. It is
  111. unspecified whether the string represented is a version of the
  112. argument list as it was passed to the command when it started,
  113. or is a version of the arguments as they may have been modified
  114. by the application. Applications cannot depend on being able to
  115. modify their argument list and having that modification be
  116. reflected in the output of ps.
  117. Any field need not be meaningful in all implementations. In such a case
  118. a hyphen ( '-' ) should be output in place of the field value.
  119. Only comm and args shall be allowed to contain <blank>s; all others
  120. shall not.
  121. The following table specifies the default header to be used in the
  122. POSIX locale corresponding to each format specifier.
  123. Format Specifier Default Header Format Specifier Default Header
  124. args COMMAND ppid PPID
  125. comm COMMAND rgroup RGROUP
  126. etime ELAPSED ruser RUSER
  127. group GROUP time TIME
  128. nice NI tty TT
  129. pcpu %CPU user USER
  130. pgid PGID vsz VSZ
  131. pid PID
  132. There is no special quoting mechanism for header text. The header text
  133. is the rest of the argument. If multiple header changes are needed,
  134. multiple -o options can be used, such as:
  135. ps -o "user=User Name" -o pid=Process\ ID