首页 > 解决方案 > 到达正确的手册页

问题描述

当我在 shell 提示符下键入“man read”时,它会显示 read shell 命令,我如何打开 read() C 函数的文档。我的问题不仅适用于 read 适用于类似的其他功能,例如 sleep()

当它发生时,我通常会跑到https://linux.die.net并在那里参考文档,我相信有办法从 shell 提示符本身进入正确的手册页

标签: shellmanpage

解决方案


man <section #> <page>

从手册页:

   The table below shows the section numbers of the manual followed by the types of pages they contain.

   1   Executable programs or shell commands
   2   System calls (functions provided by the kernel)
   3   Library calls (functions within program libraries)
   4   Special files (usually found in /dev)
   5   File formats and conventions eg /etc/passwd
   6   Games
   7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
   8   System administration commands (usually only for root)
   9   Kernel routines [Non standard]

要查找给定页面存在哪些部分,您可以使用以下-k标志:

$ man -k ^sleep$
sleep (1)            - delay for a specified amount of time
sleep (3)            - sleep for a specified number of seconds

推荐阅读