一、man文件的section
1 - commands 普通的命令
2 - system calls 系统函数调用
3 - library calls 库函数调用
4 - special files 特殊文件
5 - file formats and convertions 文件的格式和转换
6 - games for linux
7 - macro packages and conventions
8 - system management commands 系统管理用的命令,
9 - 其他
二、man命令
可以通过一些参数,快速查询linux帮助手册,并且格式化显示。
1.语法
man [-adfhktwW] [section] [-M path] [-P pager] [-S list] [-m system] [-p string] title…
2.man命令常用参数
参数 | 备注 |
---|---|
-a | 显示所有匹配项 |
-d | 显示man查照手册文件时候,搜索路径信息,不显示手册页内容 |
-D | 同-d,显示手册页内容 |
-f | 同命令whatis ,将在whatis数据库查找以关键字开同的帮助索引信息 |
-h | 显示帮助信息 |
-k | 同命令apropos 将搜索whatis数据库,模糊查找关键字 |
-S list | 指定搜索的领域及顺序 如:-S 1:1p httpd 将搜索man1然后 man1p目录 |
-t | 使用troff 命令格式化输出手册页 默认:groff输出格式页 |
-w | 不带搜索title 打印manpath变量 带title关键字 打印找到手册文件路径,默认搜索一个文件后停止 |
-W | 同-w |
-c | 显示使用 cat 命令的手册信息 |
-C | 指定man 命令搜索配置文件 默认是man.config |
-K | 搜索一个字符串在所有手册页中,速度很慢 |
-M | 指定搜索手册的路径 |
-P pro | 使用程序pro显示手册页面 默认是less |
-B pro | 使用pro程序显示HTML手册页 默认是less |
-H pro | 使用pro程序读取HTML手册,用txt格式显示,默认是cat |
-p str | 指定通过groff格式化手册之前,先通过其它程序格式化手册 |
3.示例
显示passwd帮助文件路径,passwd.1 ,默认只会查找一个
[root@master ~]# man -w passwd
/usr/share/man/man1/passwd.1.gz
加入-a获得所有帮助手册文件地址
[root@master ~]# man -aw passwd
/usr/share/man/man1/passwd.1.gz
/usr/share/man/man5/passwd.5.gz
man5 文件配置信息说明 手册目录
[root@master ~]# man 5 passwd
返回man 执行过程搜索查找方法,以及查询手册通过怎么样格式化语句显示。都会列出来。
可以看到,指定pages,borwser输出命令对应文件,html输出文件,搜索路径,由于我当前LANG=zh_CN.gb2312因此,添加了zh_CN目录搜索,最终执行命令时候,通过一系列格式转换命令,最终有less显示。
[root@master ~]# man -d passwd
Reading config file /etc/man.config.....
found man directory /usr/man
using /usr/bin/less -is as pager
using /usr/bin/less -is as browser
using /bin/cat to dump HTML pages as text
path directory /bin is in the config file
adding /usr/share/man/zh_CN to manpath
adding /usr/share/man to manpath
found 'NROFF_OLD_CHARSET' in path
old charset of '/usr/share/man/man1/passwd.1.gz' is 'ISO-8859-1'
man:
not executing command:
(cd /usr/share/man && (echo ".ll 11.8i"; echo ".nr LL 11.8i"; echo ".pl 1100i"; /usr/bin/gunzip -c '/usr/share/man/man1/passwd.1.gz'; echo ".\\\""; echo ".pl \n(nlu+10") | /usr/bin/gtbl | /usr/bin/nroff -c --legacy ISO-8859-1 -mandoc 2>/dev/null | /usr/bin/less -is)
在领域类型是:1:2 范围内查找手册,对应目录分别是man1 ,man2
[root@master ~]# man -S 1:2 passwd
在whatis数据库(有所有网站man帮助以及cat,doc帮助信息索引)中查询,文件标题以:http开头信息的文档,中间的(8) 对应我们可以用:man 8 httpd 调用,对于显示(rpm)实际上显示有个httpd帮助信息,是属于一个httpd rpm安装包,通过man rpm httpd查看不了。可以通过rpm -ql httpd 查找安装包
[root@master ~]# man -f httpd
httpd (8) - Apache Hypertext Transfer Protocol Server
httpd (rpm) - Apache HTTP Server
httpd-devel (rpm) - Development tools for the Apache HTTP server.
在whatis数据库中,查询包含httpd所有帮助手册,以及安装包. 可以通过:rpm -ql lighttpd
[root@master ~]# man -k httpd
CGI::Carp (3pm) - CGI routines for writing to the HTTPD (or other) error log
httpd (8) - Apache Hypertext Transfer Protocol Server
httpd (rpm) - Apache HTTP Server
httpd-devel (rpm) - Development tools for the Apache HTTP server.
httpd_selinux (8) - Security Enhanced Linux Policy for the httpd daemon
lighttpd (1) - a fast, secure and flexible webserver
lighttpd (rpm) - Lightning fast webserver with light system requirements
lighttpd-fastcgi (rpm) - FastCGI module and spawning helper for lighttpd and PHP configuration
ncsa_auth (8) - NCSA httpd-style password file authentication helper for Squid
显示man 命令查找手册的路径
[root@master ~]# man -w
/usr/kerberos/man:/usr/local/share/man:/usr/share/man/zh_CN:/usr/share/man:/usr/local/man
三、其他命令
1.apropos
apropos 命令可以简短地显示配置文件的帮助信息
[root@master man1]# apropos
apropos what?
2.whatis
如果你觉得 man 命令输出的信息太多,而你不想看那么多信息,就想知道这个命令是用来干什么的,可以用 whatis 这个命令。
3.help shell内置命令
4.Info
Info类似于man,它具有一个超链接的结构,可以将页面链接在一起。信息文档默认位置:/usr/share/info
————Blueicex 2020/2/7 13:17 [email protected]