Что использовать ps ef или ps -ef?

Я вижу, что разница между выводами между ps ef и ps -ef. В чем разница, являются ли обе команды правильными или предпочтительными?

11
задан 3 August 2017 в 11:06

6 ответов

См. man ps (тот, что в вашей системе, он-лайн может иметь разные объяснения).

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 ef) является стилем BSD, а страница руководства on with

Использование параметров стиля BSD добавит состояние процесса (stat = STAT) к дисплею по умолчанию и покажет команду args (args = COMMAND) вместо исполняемого имени. Вы можете переопределить это с помощью переменной среды PS_FORMAT. Использование опций типа BSD также изменит выбор процесса, чтобы включить процессы на других терминалах (TTY), которые принадлежат вам; поочередно это можно описать как установление выбора как совокупность всех процессов, отфильтрованных для исключения процессов, принадлежащих другим пользователям, или нет на терминале. Эти эффекты не учитываются, когда параметры описываются как «идентичные» ниже, поэтому -M будет считаться идентичным Z и так далее.

Таким образом, обе являются действительными командами, но они не показывают одну и ту же информацию.

17
ответ дан 22 May 2018 в 19:52

См. man ps (тот, что в вашей системе, он-лайн может иметь разные объяснения).

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 ef) является стилем BSD, а страница руководства on with

Использование параметров стиля BSD добавит состояние процесса (stat = STAT) к дисплею по умолчанию и покажет команду args (args = COMMAND) вместо исполняемого имени. Вы можете переопределить это с помощью переменной среды PS_FORMAT. Использование опций типа BSD также изменит выбор процесса, чтобы включить процессы на других терминалах (TTY), которые принадлежат вам; поочередно это можно описать как установление выбора как совокупность всех процессов, отфильтрованных для исключения процессов, принадлежащих другим пользователям, или нет на терминале. Эти эффекты не учитываются, когда параметры описываются как «идентичные» ниже, поэтому -M будет считаться идентичным Z и так далее.

Таким образом, обе являются действительными командами, но они не показывают одну и ту же информацию.

17
ответ дан 18 July 2018 в 09:09

См. man ps (тот, что в вашей системе, он-лайн может иметь разные объяснения).

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 ef) является стилем BSD, а страница руководства on with

Использование параметров стиля BSD добавит состояние процесса (stat = STAT) к дисплею по умолчанию и покажет команду args (args = COMMAND) вместо исполняемого имени. Вы можете переопределить это с помощью переменной среды PS_FORMAT. Использование опций типа BSD также изменит выбор процесса, чтобы включить процессы на других терминалах (TTY), которые принадлежат вам; поочередно это можно описать как установление выбора как совокупность всех процессов, отфильтрованных для исключения процессов, принадлежащих другим пользователям, или нет на терминале. Эти эффекты не учитываются, когда параметры описываются как «идентичные» ниже, поэтому -M будет считаться идентичным Z и так далее.

Таким образом, обе являются действительными командами, но они не показывают одну и ту же информацию.

17
ответ дан 24 July 2018 в 19:15

man ps говорит:

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.

Итак, ef использует опции BSD e и f, а -ef использует опции Unix -e и -f , Они различны (разделы SIMPLE PROCESS SELECTION, OUTPUT FORMAT CONTROL и OUTPUT MODIFIERS соответственно):

   -e     Select all processes.  Identical to -A.
   -f     Do full-format listing. This option can be combined with many
          other UNIX-style options to add additional columns.  It also
          causes the command arguments to be printed.  When used with
          -L, the NLWP (number of threads) and LWP (thread ID) columns
          will be added.  See the c option, the format keyword args, and
          the format keyword comm.

   e      Show the environment after the command.

   f      ASCII art process hierarchy (forest).

Очевидно, что вы не выбираете все процессы, используя опции ef, но используете по умолчанию список процессов, а также некоторое дополнительное форматирование:

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.

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.

Что вы должны использовать? Что вы хотите делать с выходом?

Кроме того, см. Раздел man ps (который довольно заметно отображает -ef и не использует BSD [ f18] вообще):

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:
      ps ax
      ps axu

   To print a process tree:
      ps -ejH
      ps axjf
17
ответ дан 22 May 2018 в 19:52

man ps говорит:

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.

Итак, ef использует опции BSD e и f, а -ef использует опции Unix -e и -f , Они различны (разделы SIMPLE PROCESS SELECTION, OUTPUT FORMAT CONTROL и OUTPUT MODIFIERS соответственно):

-e Select all processes. Identical to -A. -f Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm. e Show the environment after the command. f ASCII art process hierarchy (forest).

Очевидно, что вы не выбираете все процессы, используя опции ef, но используете по умолчанию список процессов, а также некоторое дополнительное форматирование:

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

Что вы должны использовать? Что вы хотите делать с выходом?

Кроме того, см. Раздел man ps (который довольно заметно отображает -ef и не использует BSD e вообще):

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: ps ax ps axu To print a process tree: ps -ejH ps axjf
17
ответ дан 18 July 2018 в 09:09

man ps говорит:

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.

Итак, ef использует опции BSD e и f, а -ef использует опции Unix -e и -f , Они различны (разделы SIMPLE PROCESS SELECTION, OUTPUT FORMAT CONTROL и OUTPUT MODIFIERS соответственно):

-e Select all processes. Identical to -A. -f Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm. e Show the environment after the command. f ASCII art process hierarchy (forest).

Очевидно, что вы не выбираете все процессы, используя опции ef, но используете по умолчанию список процессов, а также некоторое дополнительное форматирование:

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

Что вы должны использовать? Что вы хотите делать с выходом?

Кроме того, см. Раздел man ps (который довольно заметно отображает -ef и не использует BSD e вообще):

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: ps ax ps axu To print a process tree: ps -ejH ps axjf
17
ответ дан 24 July 2018 в 19:15

Другие вопросы по тегам:

Похожие вопросы: