如何在 AIX 下使用 'ps aux' 获取 PPID?

如何在 AIX 下使用 'ps aux' 获取 PPID?

我知道这是可能的,ps -ef但我想用以下命令获取它:ps aux

该怎么做呢AIX

答案1

ps aux 是 ps 的伯克利标准。

ps [ a ] [ c ] [ e ] [ ew ] [ eww ] [ ewww ] [ g ] [ n ] [ w ] [ x ] [ l | s | u | v ] [ t tty ] [ X ] [ ProcessNumber ]

a = Displays information about all processes with terminals (ordinarily only the own processes of the user are displayed).
u = Displays user-oriented output. This includes the USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT, STIME, TIME, and COMMAND fields.
x = Displays processes without a controlling terminal in addition to processes with a controlling terminal.

正如您在命令标志中看到的,您只能使用其中之一:“[ l | s | u | v ]”

l = Displays a long listing having the F, S, UID, PID, PPID, C, PRI, NI, ADDR, SZ, PSS, WCHAN, TTY, TIME, and CMD fields.
s = Displays the size (SSIZ) of the kernel stack of each process (for use by system maintainers) in the basic output format. This value is always 0 (zero) for a multi-threaded process.
u = Displays user-oriented output. This includes the USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT, STIME, TIME, and COMMAND fields.
v = Displays the PGIN, SIZE, RSS, LIM, TSIZ, TRS, %CPU, %MEM fields.

您可以将“u”替换为“l”,但您不会拥有“u”中的所有字段。

您还可以使用 X/Open 变体:

ps -ef -o "ruser pid ppid pcpu pmem vsz rssize tty stat start time command"

如果您想要所有进程,也可以将 -e 更改为 -A。 -e 不提供内核进程,-A 提供。

-e Writes information to standard output about all processes, except kernel processes.
-A Writes to standard output information about all processes.

相关内容