Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1366702
  • 博文数量: 245
  • 博客积分: 10021
  • 博客等级: 上将
  • 技术积分: 3094
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-12 14:51
文章存档

2011年(2)

2009年(152)

2008年(91)

我的朋友

分类:

2009-01-19 15:16:00

NAME
ps - report a snapshot of the current processes.
报告运行程序的快照
SYNOPSIS
ps [options]
 
DESCRIPTION(描述)
ps displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information, use top(1)instead.
ps命令显示运行程序选项的一些信息。如果你想显示选项的一些重复信息,请使用top命令替代。
 
This version of ps accepts several kinds of options:
1   UNIX options, which may be grouped and must be preceded by a dash.
2   BSD options, which may be grouped and must not be used with a dash.
3   GNU long options, which are preceded by two dashes.
 
ps显示几种类型的选项:

1 UNIX选项,可能是成组的,通过破折号罗列在所有选项之前。

2 BSD选项,可能是成组的,但是必须不使用破折号。

3 GNU长选项,在两个破折号之前。

Options of different types may be freely mixed, but conflicts can appear. There are some synonymous options, which are functionally identical, due to the many
standards and ps implementations that this ps is compatible with.
 
每种选项自由的混合在一起,但是相互冲突会显现,有一些同义的选项,功能相同,由于有许多标准存在,ps对不同选项的执行是可以共存的。

Note that "ps -aux" is distinct from "ps aux". The POSIX and UNIX standards require that "ps -aux" print all processes owned by a user named "x", as well as
printing all processes that would be selected by the -a option. If the user named "x" does not exist, this ps may interpret the command as "ps aux" instead and print a warning. This behavior is intended to aid in transitioning old scripts and habits. It is fragile, subject to change, and thus should not be relied upon.

注意 ps -aux 和ps aux是完全不同的,POSIX和UNIX标准要求ps -aux列出所有拥有者名字是x的进程,也打印出所有被-a选项选择的进程。如果用户名X不存在,这个ps就用ps aux来解释命令,替代ps -aux选项并打印出警告,这个行为有意帮助ps过渡旧的scripts和习惯。这很脆弱,服从变化,不应该以来这种方式。
 
By default, ps selects all processes with the same effective user ID (euid=EUID)as the current user and associated with the same terminal as the invoker. It
displays the process ID (pid=PID), the terminal associated with the process(tname=TTY), the cumulated CPU time in [dd-]hh:mm:ss format (time=TIME), and the executable name (ucmd=CMD). Output is unsorted by default.

默认的,ps选择所有
和运行用户同样有效的用户id进程,与用户相关联的终端请求,ps罗列进程号pid,终端内的进程,cpu的累加时间和执行的命令,默认输出不加整理。
 
The use of BSD-style options will add process state (stat=STAT) to the default display and show the command args (args=COMMAND) instead of the executable name.
You can override this with the PS_FORMAT environment variable. The use of BSD-style options will also change the process selection to include processes on other terminals (TTYs) that are owned by you; alternately, this may be described as setting the selection to be the set of all processes filtered to exclude processes owned by other users or not on a terminal. These effects are not considered when options are described as being "identical" below, so -M will be considered identical to Z and so on.

BSD模式的选项将给默认的罗列和命令加上进程状态,以代替执行名。你可以使用
PS_FORMAT环境而不顾这些进程状态。BSD-style选项功能也改变进程,包括在其他属于你的终端内的进程。轮流的,设定选项的描述,成为所有的进程过滤其他用户执行进程或者不在一个终端上。当选项描述成identical,这些结果不被考虑所以-M选项将被考虑identical到Z等等的。
 
Except as described below, process selection options are additive. The default selection is discarded, and then the selected processes are added to the set of processes to be displayed. A process will thus be shown if it meets any of the given selection criteria.

除了以下的描述之外,进程选项是额外加上的,默认的选项被丢弃,被选择进程加在设置上被罗列出来,如果进程被给予了给定选项,进程将这样被罗列出来。


EXAMPLES
To see every process on the system using standard syntax:
用标准语法查看系统上的每一个进程。
   ps -e
   ps -ef
   ps -eF
   ps -ely
 
To see every process on the system using BSD syntax:
用BSD语法查看系统上的每一个进程。

   ps ax
   ps axu
 
To print a process tree:
   ps -ejH
   ps axjf
 
To get info about threads:
   ps -eLf
   ps axms
 
To get security info:
   ps -eo euser,ruser,suser,fuser,f,comm,label
   ps axZ
   ps -eM
 
To see every process running as root (real & effective ID) in user format:
   ps -U root -u root u
 
To see every process with a user-defined format:
   ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
   ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
   ps -eopid,tt,user,fname,tmout,f,wchan
 
Print only the process IDs of syslogd:
   ps -C syslogd -o pid=
 
Print only the name of PID 42:
   ps -p 42 -o comm=
 
SIMPLE PROCESS SELECTION
-A              Select all processes. Identical to -e.
 
-N              Select all processes except those that fulfill the specified
                conditions. (negates the selection) Identical to --deselect.
 
T               Select all processes associated with this terminal. Identical to
                the t option without any argument.
 
-a              Select all processes except session leaders (see getsid(2)) and
                processes not associated with a terminal.
 
a               Lift the BSD-style "only yourself" restriction, which is imposed
                upon the set of all processes when some BSD-style (without "-")
                options are used or when the ps personality setting is BSD-like.
                The set of processes selected in this manner is in addition to
                the set of processes selected by other means. An alternate
                description is that this option causes ps to list all processes
                with a terminal (tty), or to list all processes when used
                together with the x option.
 
-d              Select all processes except session leaders.
 
-e              Select all processes. Identical to -A.
 
g               Really all, even session leaders. This flag is obsolete and may
                be discontinued in a future release. It is normally implied by
                the a flag, and is only useful when operating in the sunos4
                personality.
 
r               Restrict the selection to only running processes.
 
x               Lift the BSD-style "must have a tty" restriction, which is
                imposed upon the set of all processes when some BSD-style
                (without "-") options are used or when the ps personality setting
                is BSD-like. The set of processes selected in this manner is in
                addition to the set of processes selected by other means. An
                alternate description is that this option causes ps to list all
                processes owned by you (same EUID as ps), or to list all
                processes when used together with the a option.
 
--deselect      Select all processes except those that fulfill the specified
                conditions. (negates the selection) Identical to -N.





 
阅读(6266) | 评论(0) | 转发(0) |
0

上一篇:kill命令详解

下一篇:top命令详解

给主人留下些什么吧!~~