对man手册结构的一次详细梳理(感谢第四期一生一芯项目组帮我打基础)
整个manual分成9大类, 每个manual page都属于其中的某一类;
manual 的类别主要有:
 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, e.g. /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]
你看到了一个manual page主要包含以下的小节:
- NAME - 命令名
- SYNOPSIS - 使用方法大纲
- CONFIGURATION - 配置
- DESCRIPTION - 功能说明
- OPTIONS - 可选参数说明
- EXIT STATUS - 退出状态, 这是一个返回给父进程的值
- RETURN VALUE - 返回值
- ERRORS - 可能出现的错误类型
- ENVIRONMENT - 环境变量
- FILES - 相关配置文件
- VERSIONS - 版本
- CONFORMING TO - 符合的规范
- NOTES - 使用注意事项
- BUGS - 已经发现的bug
- EXAMPLE - 一些例子
- AUTHORS - 作者
- SEE ALSO - 功能或操作对象相近的其它命令
使用man printf 默认会调出section1(shell command)的手册页,如果想看section3(库函数)的printf的话,则需要输入 man 3 printf
man -k keywords 搜索和Keywords相关的manual pages
当你想做一件事的而不知道用什么命令的时候, man的-k参数可以用来列出候选的命令, 然后再通过查看这些命令的manual page来学习怎么使用它们.
感受:学计算机5年了,用了5年man,从来不知道原来man还有这么多学问,感谢一生一芯项目组
 
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号