liunx下的帮助

在 liunx 下获得帮助命令有 whatis,help,和 man。运用最多  内容最丰富的就是慢 man。

一:whatis: 基于数据库的查找,查找速度快,但是没有实时性。

数据库文件
Centos6:/var/cache/man/whatis
Centos7:/var/cache/man/index.db
更新数据库文件
Centos6:makewhatis
Centos7:mandb

二:help

help 命令在查看内部命令是 格式为 help command 例如: 

help cd
help pwd
help enable

外部命令时为 command  --help 例如  

ls --help

三 :man

要想使用中文 man(默认英文),需要先安装 man,在 linux 下安装命令如下:

1. 挂载光盘

mount /dev/cdrom /media/

2. 安装中文 man 的软件包

rpm -ivh /media/Packages/man-pages-zh-CN-1.5.2-4.el7.noarch.rpm

3. 将中文 man 的路径写的 man 的配置文件

gedit /etc/man_db.conf 增加一行,内容如下

MANDATORY_MANPATH /usr/share/man/zh_CN

4.man -a ls(使用时加上 -a 显示中文版,默认英文要想 q 退出,然后空格显示中文)。

                                                  man 的使用:

f 向下翻一页

b 向上翻一页

d 向下翻半页

u 向上翻半页

 G 跳至尾页

 g 跳至首页

 搜索关键

   / 关键字 n 向下 N 向上

   ? 关键字 n 向上

    q 退出 man

man 的章节,man 的关键字有多个文件与之匹配,则按类型,划分为以下 9 个章节
* 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]

man 章节号 关键字 (若省略章节号,则显示数字较小的章节)

man -a 关键字 依次查看指定关键字的所有章节
man -w 关键字 查看关键字匹配到的第一个章节的来源文件

man -aw 关键字 查看关键字匹配到的所有章节的来源文件

man -f 关键字 等于 whatis 关键字