linux 命令 之 ps

版权声明:本文为博主原创文章,未经博主允许不得转载。当然你如果觉得对你有用,请动一动你的小爪,点个赞 https://blog.csdn.net/qq_16877261/article/details/80468770

https://blog.csdn.net/lsbhjshyn/article/details/18549869    ps 命令详解参考

https://blog.csdn.net/csdn066/article/details/77171018    top 命令详解

ps  是对当前进程的一个快照,而  top 命令可以实时的对当前进程进行查看。man 命令查看ps  翻译如下:

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.

       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 可接受的几种选项的版本:

     1  UNIX 选项  ,可以一起使用,并且一定在破折号之前出现。

     2  BSD  选项  ,可以一起使用,并且一定不能和破折号一起使用

     3  GUN  长选项  使用在两个破折号之前。

不同类型的选项可能会自由组合,但是有可能会出现冲突。有一些同义的选项,由于多种的标准 和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  并且会打印一个警告。这种方式主要为了有助于过度旧的脚本和习惯。它是虚弱的,更易改变,因此这样不应该依赖它。

       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作为当前用户并且具备同样的终端的触发者的所有进程。它会显示进程id,与进程相关的终端,累积的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.

       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.

BSD 风格的选项将会增加进程状态到默认显示中,并且显示命令参数( args=COMMAND )  代替可执行的名称。你可以使用环境变量PS_FORMAT 覆盖。BSD 风格选项将会改变进程选项,将其它终端的你拥有的进程包括进来。或者,也可以描述为设置选项 过滤掉别的用户拥有的进程或者不在终端的进程 的所有进程的集合。这些影响没被考虑,当选项被描述为“identical”,然而  -M 选项将会把这些影响考虑到。

除去下面描述的,进程选项是可添加的。默认的选择被丢弃了,并且选中的进程被添加到显示进程的集合中。

猜你喜欢

转载自blog.csdn.net/qq_16877261/article/details/80468770
今日推荐