man命令是Linux下的帮助指令,通过man指令可以查看Linux中的指令帮助、配置文件帮助和编程帮助等信息。

语法

    man (选项) (参数)


选项

    -a:在所有的man帮助手册中搜索; 
    -f:等价于whatis指令,显示给定关键字的简短描述信息; 
    -P:指定内容时使用分页程序; 
    -M:指定man手册搜索的路径。


参数

    数字:指定从哪本man手册中搜索帮助;
    关键字:指定要搜索帮助的关键字;


案例

    我们输入man ls,它会在最左上角显示“LS(1)”,在这里,“LS”表示手册名称,而“(1)”表示该手册位于第一节章,同样,我们输man ifconfig它会在最左上角显示“IFCONFIG(8)”。也可以这样输入命令:“man [章节号] 手册名称”。 

    man是按照手册的章节号的顺序进行搜索的,比如: 

# man sleep 

NAME
       sleep - delay for a specified amount of time
SYNOPSIS
       sleep NUMBER[SUFFIX]...
       sleep OPTION
DESCRIPTION
       Pause for NUMBER seconds.  SUFFIX may be ‘s’ for seconds (the default),
       ‘m’ for minutes, ‘h’ for hours or ‘d’ for days.  Unlike most  implemen-
       tations  that require NUMBER be an integer, here NUMBER may be an arbi-
       trary floating point number.  Given two or more  arguments,  pause  for
       the amount of time specified by the sum of their values.
       --help display this help and exit
       --version
              output version information and exit



    只会显示sleep命令的手册,如果想查看库函数sleep,就要输入: 

# man 3 sleep

Cannot open the message catalog "man" for locale "zh_CN.UTF-8"
(NLSPATH="/usr/share/locale/%l/LC_MESSAGES/%N")
No entry for sleep in section 3 of the manual