Aix

如何在 AIX 下使用 ‘ps aux’ 獲取 PPID?

  • April 29, 2018

我知道這是可能的,ps -ef但我想用命令得到它:ps aux

怎麼做AIX

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.

引用自:https://unix.stackexchange.com/questions/237214