获取bash内嵌命令帮助信息方法很简单

[root@localhost ~]# help alias
alias: alias [-p] [name[=value] ... ]
    Define or display aliases.
    
    Without arguments, `alias' prints the list of aliases in the reusable
    form `alias NAME=VALUE' on standard output.
    
    Otherwise, an alias is defined for each NAME whose VALUE is given.
    A trailing space in VALUE causes the next word to be checked for
    alias substitution when the alias is expanded.
    
    Options:
      -p    Print all defined aliases in a reusable format
    
    Exit Status:
    alias returns true unless a NAME is supplied for which no alias has been
    defined.


判断是否是bash的内嵌命令

[root@localhost ~]# type cd 
cd is a shell builtin
[root@localhost ~]# type ip
ip is /usr/sbin/ip

 

外部命令获取帮助信息的方式就比较多了


1. 命令自带的帮助信息

[root@localhost ~]# whatis --help
Usage: whatis [OPTION...] KEYWORD...
  -d, --debug                emit debugging messages
  -v, --verbose              print verbose warning messages
  -r, --regex                interpret each keyword as a regex
  -w, --wildcard             the keyword(s) contain wildcards
  -l, --long                 do not trim output to terminal width
  -C, --config-file=FILE     use this user configuration file
  -L, --locale=LOCALE        define the locale for this search
  -m, --systems=SYSTEM       use manual pages from other systems
  -M, --manpath=PATH         set search path for manual pages to PATH
  -s, --sections=LIST, --section=LIST
                             search only these sections (colon-separated)
  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Report bugs to cjwatson@debian.org.

2. 使用手册(Manual)

[root@localhost ~]# man passwd


但是在很多时候,一个命令也可能同时是系统函数或是其他程序中的出现的关键字,所以可能出现在man手册的不同章节中,可以先用whatis命令查看该关键字在man手册的哪些章节中出现过。

[root@localhost ~]# whatis passwd
sslpasswd (1ssl)     - compute password hashes
passwd (1)           - update user's authentication tokens
passwd (5)           - password file

或者

[root@localhost ~]# man -f passwd
sslpasswd (1ssl)     - compute password hashes
passwd (1)           - update user's authentication tokens
passwd (5)           - password file


这里的结果是通过查找man手册数据库找到的,这个数据库是每天定时更新的。也就是说当天新安装的程序包的man手册,没到更新时间是不会记入数据库中,使用whatis命令可能就找不到该手册了。这个时候就需要手动更新该数据库了。

在CentOS6以前

[root@localhost ~]# makewhatis

在CentOS7中改为

[root@localhost ~]# mandb



man手册的各章节是如何分类的

       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]



这时便可以查看指定章节的手册了

[root@localhost ~]# man 5 passwd


有些并非发行版自带的程序包或者是需要手动编译的程序包,在安装过程中并不会将它们的使用手册安装到$MANPATH中去,man在$MANPATH中搜索使用手册时就找不到这些非标准安装手册。


此时有两种解决方案,一种是在$MANPATH中加入非标准安装的手册路径;

在CentOS6以前$MANPATH是在/etc/man.config中配置的;

在CentOS7中修改为在/etc/man_db.conf中配置。

另一种是使用man命令时直接指定非标准安装的手册路径。

[root@localhost ~]# man -M PATH/TO/SOMEDIR mysql


3. 获取在线文档

[root@localhost ~]# info passwd


4. 程序自带文档

部分程序安装完成后在目录/usr/share/doc/APPLICATION_NAME-VERSION/中一般都会有类似以下文档。

README:     程序的相关信息
INSTALL:    程序的安装帮助
CHANGES:    版本迭代的更新信息


5. 程序主站文档

Document
wiki
FAQ


6. 发行版主站文档

RedHat CentOS Fedora


7. 搜索引擎

Google

首先需要科学上网,然后需要掌握一些Google高级搜索语法

hadoop filetype:pdf
hadoop site:redhat.com