命令 ps 带选项 -l

command ps with option -l

我正在开发 linux 终端,Fedora。我想找到已执行 fork() 调用的进程数。我使用第一个命令 ps -elf 列出所有进程以及所有可能的详细信息。

我想知道左起第一列"F"指的是什么?也许 children 的数量 parent?

p.s: 手册没有提到选项 -l 的细节。

其实男人给出的答案是:

f F flags associated with the process, see the PROCESS FLAGS section. (alias flag, flags).

然后如果您查看 PROCESS FLAGS 部分,您会得到:

PROCESS FLAGS The sum of these values is displayed in the "F" column, which is provided by the flags output specifier. 1 forked but didn't exec 4 used super-user privileges

这可能会解释为什么您在此列中只得到 0、1、4 或 5 作为值,

这是如何显示 ps 命令输出的选项。

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).

如果ps -l,它将显示以下详细信息,

Usage:
 ps [options]

Selection by list:
 -C <command>         command name
 -G, --Group <gid>    real group id or name
 -g, --group <group>  session or effective group name
 -p, --pid <pid>      process id
     --ppid <pid>     select by parent process id
 -s, --sid <session>  session id
 -t, t, --tty <tty>   terminal
 -u, U, --user <uid>  effective user id or name
 -U, --User <uid>     real user id or name

  selection <arguments> take either:
    comma-separated list e.g. '-u root,nobody' or
    blank-separated list e.g. '-p 123 4567'

For more details see ps(1).