Linux中的man page指令

以Linux上的date命令为例,在控制台输入 man date,将会展示如下界面:


[vbird@www ~]$ man date 
DATE(1)                          User Commands                         DATE(1) 
# 请注意上面这个括号内的数字 
NAME  <==这个命令的完整全名,如下所示为date且说明简单用途为配置与显示日期/时间 
       date - print or set the system date and time 
 
SYNOPSIS  <==这个命令的基本语法如下所示 
       date [OPTION]... [+FORMAT] 
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 
 
DESCRIPTION  <==详细说明刚刚语法谈到的选项与参数的用法 
       Display  the  current  time  in  the given FORMAT, or set the system 
       date. 
 
       -d, --date=STRING  <==左边-d为短选项名称,右边--date为完整选项名称 
              display time described by STRING, not 'now' 
 
       -f, --file=DATEFILE 
              like --date once for each line of DATEFILE 
 
       -r, --reference=FILE 
              display the last modification time of FILE 
....(中间省略).... 
       # 找到了!底下就是格式化输出的详细数据! 
       FORMAT controls the output.  The only valid option  for  the  second 
       form  specifies  Coordinated  Universal Time.  Interpreted sequences 
       are: 
 
       %%     a literal % 
 
       %a     locale's abbreviated weekday name (e.g., Sun) 
 
       %A     locale's full weekday name (e.g., Sunday) 
....(中间省略).... 
ENVIRONMENT  <==与这个命令相关的环境参数有如下的说明 
       TZ     Specifies the timezone, unless  overridden  by  command  line 
              parameters.   If  neither  is  specified,  the  setting  from 
              /etc/localtime is used. 
 
AUTHOR  <==这个命令的作者啦! 
       Written by David MacKenzie. 
 
REPORTING BUGS  <==有问题请留言给底下的email的意思! 
       Report bugs to <bug-coreutils@gnu.org>. 
 
COPYRIGHT  <==受到著作权法的保护!用的就是 GPL 了! 
       Copyright ? 2006 Free Software Foundation, Inc. 
       This is free software.  You may redistribute copies of it under  the 
       terms      of      the      GNU      General      Public     License 
       <http://www.gnu.org/licenses/gpl.html>.  There is  NO  WARRANTY,  to 
       the extent permitted by law. 
 
SEE ALSO  


1 一般用户可以使用的命令(User Commands)
2 系统调用函数(System Calls)
3 C库函数(C Library Functions)
4 设备文件,一般位于/dev目录(Devices and Special Files)
5 配置文件或者某些文件格式(File Formats and Conventions)
6 游戏(Games)
7 杂项(Miscellanea)
8 系统管理员才可以使用的工具或者服务(System Administration tools and Deamons)
9 跟内核有关的文件(Kernel Files)
按键 进行工作
空格键 向下翻一页
[Page Down] 向下翻一页
[Page Up] 向上翻一页
[Home] 去到第一页
[End] 去到最后一页
/string 向『下』搜寻 string 这个字符串,如果要搜寻 vbird 的话,就输入 /vbird
?string 向『上』搜寻 string 这个字符串
n, N 利用 / 或 ? 来搜寻字符串时,可以用 n 来继续下一个搜寻 (不论是 / 或 ?) ,可以利用 N 来进行『反向』搜寻。举例来说,我以 /vbird 搜寻 vbird 字符串, 那么可以 n 继续往下查询,用 N 往上查询。若以 ?vbird 向上查询 vbird 字符串, 那我可以用 n 继续『向上』查询,用 N 反向查询。
q 结束这次的 man page

[vbird@www ~]$ man -f man 
man                  (1)  - format and display the on-line manual pages 
man                  (7)  - macros to format man pages 
man.config [man]     (5)  - configuration data for man
man -f的作用是列出所有相关的命令或者与命令相关的文件。
左边部分:命令(或文件)以及该命令所代表的意义(就是那个数字);
右边部分:这个命令的简易说明,例如上述的『-macros to format man pages』
当我们在控制台中输入man man时,显示的是man(1),还是man(7)呢?这里主要取决于搜索顺序,搜索顺序定义在/etc/man.conf文件中。一般情况下man man
展示的都是man(1)

[vbird@www ~]$ man -k man . [builtins] (1) - bash built-in commands, see bash(1) .TP 15 php [php] (1) - PHP Command Line Interface 'CLI' ....(中间省略).... zshall (1) - the Z shell meta-man page zshbuiltins (1) - zsh built-in commands zshzle (1) - zsh command line editor
man -k 选项是列出所有命令说明中包含关键字(此处便是man)的命令。

[vbird@www ~]$ whatis  [命令或者是数据]   <==相当于 man -f [命令或者是数据] 
[vbird@www ~]$ apropos [命令或者是数据]   <==相当于 man -k [命令或者是数据] 

需要注意的是,wahtis与apropos要能使用,必须使用root身份运行makewhatis命令。

 man page数据存储

man page的数据存储在/usr/share/man,存储目录可以在/etc/man.conf文件中配置。

原文地址:https://www.cnblogs.com/chaoguo1234/p/14825652.html