что делает-aux опцию PS, обозначают?

Вы часто передаете опции командам CLI, которые заставляют функцию вести себя по-другому. У них всех есть значение, например

  • -v означает "Подробный"
  • -l означает "Список"

ps списки команд все рабочие процессы, но если Вы передаете его -aux опция, это отображает процессы от всех пользователей, включая корень.

Таким образом, мой вопрос: Что делает -aux аргумент ps команда обозначает?

1
задан 2 May 2017 в 02:03

1 ответ

От man ps, страница руководства ps команда (только выборки):

   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.


   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.


   u      Display user-oriented format.

Так a аргумент позволяет ps покажите процессы всех пользователей только вместо текущего пользователя, если процессы подключены к терминалу.

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

u просто изменяет выходное форматирование и видимые столбцы.


Как @steeldriver упомянутый правильно в его комментарии, ps является немного особенным, потому что это поддерживает оба аргумента в стиле BSD (a) и стиль GNU (-a). Поэтому ps aux не точно то же как ps -aux, хотя это может быть реализовано, чтобы сделать то же для более легкой миграции. В соответствующем абзаце страницы справочника говорится:

   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.
3
ответ дан 7 December 2019 в 12:33

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

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