为什么在命令行输出重复项

输入以下命令将打印重复的内容,如下所示。并非所有行都会打印两次,但有些行会打印两次。是什么赋予了?

XXXX:~ XXXX$ man -k pid
pid(ntcl)                - Retrieve process identifiers
pidpersec.d(1m)          - print new PIDs per sec. Uses DTrace
rwbypid.d(1m)            - read/write calls by PID. Uses DTrace
syscallbypid.d(1m)       - syscalls by process ID. Uses DTrace
git(1)                   - the stupid content tracker
Sub::Exporter::Cookbook(3pm) - useful, demonstrative, or stupid Sub::Exporter tricks
Tcl_DetachPids(3tcl), Tcl_ReapDetachedProcs(3tcl), Tcl_WaitPid(3tcl) - manage child processes in background
getpid(2), getppid(2)    - get parent or calling process identification
pid(ntcl)                - Retrieve process identifiers
pidpersec.d(1m)          - print new PIDs per sec. Uses DTrace
pthread_setugid_np(2)    - Set the per-thread userid and single groupid
rwbypid.d(1m)            - read/write calls by PID. Uses DTrace
syscallbypid.d(1m)       - syscalls by process ID. Uses DTrace
wait(2), wait3(2), wait4(2), waitpid(2) - wait for process termination
git(1)                   - the stupid content tracker
XXXX:~ XXXX$ 
你好

我认为,由于它正在通过描述和手册页名称进行正则表达式搜索,因此会找到多个匹配项并多次显示这些页面。

   man -k printf
       Search the short descriptions and manual page names for the  keyword  
       printf  as  regular  expression. Print out any matches.  Equivalent to 
       apropos -r printf.

如果很烦人,您可以使用过滤输出sort -u

$ man -k pid|sort -u
getpid (2)           - get process identification
getpid (3p)          - get the process ID
getpidcon (3)        - get SELinux security context of a process
getpidcon_raw (3)    - get SELinux security context of a process
getppid (2)          - get process identification
getppid (3p)         - get the parent process ID
git (1)              - the stupid content tracker
mysql_waitpid (1)    - kill process and wait for its termination
pidgin (1)           - Instant Messaging client
pid (n)              - Retrieve process identifiers
pidof (8)            - find the process ID of a running program.
pidstat (1)          - Report statistics for Linux tasks.
Proc::Killfam (3pm)  - kill a list of pids, and all their sub-children
Sub::Exporter::Cookbook (3pm) - useful, demonstrative, or stupid Sub::Exporter tricks
Tcl_DetachPids (3)   - manage child processes in background
Tcl_WaitPid (3)      - manage child processes in background
waitpid (2)          - wait for process to change state
waitpid (3p)         - wait for a child process to stop or terminate

如果需要调试man环境,则可以始终使用该-d开关。这也将报告man设置的各种路径和配置

$ man -d
From the config file /etc/man_db.conf:

Mandatory mandir `/usr/man'.
Mandatory mandir `/usr/share/man'.
Mandatory mandir `/usr/local/share/man'.
Path `/bin' mapped to mandir `/usr/share/man'.
Path `/usr/bin' mapped to mandir `/usr/share/man'.
Path `/sbin' mapped to mandir `/usr/share/man'.
Path `/usr/sbin' mapped to mandir `/usr/share/man'.
Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.
Path `/usr/local/sbin' mapped to mandir `/usr/local/share/man'.
Path `/usr/X11R6/bin' mapped to mandir `/usr/X11R6/man'.
Path `/usr/bin/X11' mapped to mandir `/usr/X11R6/man'.
Path `/usr/games' mapped to mandir `/usr/share/man'.
Path `/opt/bin' mapped to mandir `/opt/man'.
Path `/opt/sbin' mapped to mandir `/opt/man'.
....

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章