如何在 linux 中获得 C 函数的手册页而不是使用 bash 命令的人?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18920539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get in linux the man page for C functions and not the man with bash commands?
提问by George
How can I get in linux the man page for C functions and not the shell commands manual?
如何在 linux 中获得 C 函数的手册页而不是 shell 命令手册?
For example when I type man bind
I get the man for shell command bind and not the man for socket binding C function.
例如,当我输入时,man bind
我得到了 shell 命令绑定的 man,而不是套接字绑定 C 函数的 man。
采纳答案by Joe
man 2 bind
You need a result from a different section of the manual! Man searches various sections for the information you want. As devnull lists below, the number indicates which section to search.
您需要来自手册不同部分的结果!Man 会在各个部分中搜索您想要的信息。正如下面的 devnull 列表,数字表示要搜索的部分。
Incidentally, bind
is a system call, not a C library function. System calls (kernel calls) are in section 2 of the manual, library functions are in section 3.
顺便说一句,bind
是系统调用,不是C库函数。系统调用(内核调用)在手册的第 2 部分,库函数在第 3 部分。
man man
will tell you how to use the man command!
man man
会告诉你如何使用man命令!
回答by devnull
Saying man man
would tell you:
话说man man
会告诉你:
SYNOPSIS 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]
SYNOPSIS 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]
For example, man 1 printf
would show the manual for the printf
shell utility, while man 3 printf
would show the manual for printf()
in libc.
例如,man 1 printf
会显示printf
shell 实用程序man 3 printf
的手册,而会显示printf()
libc的手册。
(When in doubt, say man -k foobar
. It will provide a list of man pages with foobar
as the regex.)
(如有疑问,请说man -k foobar
。它将提供一个手册页列表,foobar
作为正则表达式。)