我用不同种类的开关试过ps,例如-A,aux,ef等,但我似乎找不到合适的开关组合,它们会告诉我进程ID(PID),父进程ID(PPID),进程组ID(PGID)和会话ID (SID)同一输出中的进程。
答案 0 :(得分:0)
你走了:
$ ps xao pid,ppid,pgid,sid | head
PID PPID PGID SID
1 0 1 1
2 0 0 0
3 2 0 0
6 2 0 0
7 2 0 0
21 2 0 0
22 2 0 0
23 2 0 0
24 2 0 0
If you want to see the process' name as well, use this:
$ ps xao pid,ppid,pgid,sid,comm | head
PID PPID PGID SID COMMAND
1 0 1 1 init
2 0 0 0 kthreadd
3 2 0 0 ksoftirqd/0
6 2 0 0 migration/0
7 2 0 0 watchdog/0
21 2 0 0 cpuset
22 2 0 0 khelper
23 2 0 0 kdevtmpfs
24 2 0 0 netns