Linux的帮助系统_(4)man page
man是manul(说明手册)的缩写,man page 相比于–help查询到的内容更加详细,甚至会包括该命令的作者,乃至于与该命令相关的其他命令.
语法:
$ man 命令
实例:
$ man date
- 上面的命令就是查询date这个代码的详细内容
输入代码之后,就会弹出date这个代码的相关内容的界面,叫做man page,十分的详尽.
不过虽然详尽,但是还是有点问题,因为整个man page分为好几个部分,会有点难看懂,还是需要解释下man page的每个部分和相关代号表示的含义以及如何操作.
man page详解
下面以输入上面date的man page为例进行说明,讲解一些比较重要的,不重要的直接在表注中就有所说明
man page实例
date的man page页面如下:
[ wangsh ]~ $ 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 <==这个重要,你还可以从哪里查到与date相关的说明文件之意
The full documentation for date is maintained as a Texinfo manual.
If the info and date programs are properly installed at your site,
the command
info date
should give you access to the complete manual.
date 5.97 Nov 2019 DATE(1)
下面将分块介绍整个man page的每一个部分是什么意思
基础信息
DATE(1) User Commands DATE(1)
- date是命令的全称
- 数字(如这里的(1))表明查询内容的属性
具体数字代表的含义见下表:
数字 | 含义 |
---|---|
1 | 用户在shell环境中可以操作的命令或可执行文件 |
2 | 系统内核可调用的函数与工具 |
3 | 一些常用的函数(function)与函数库(library),大部分为c语言库(libc) |
4 | 设备文件的说明,通常是在/dev下的文件 |
5 | 配置文件或是某些文件的格式 |
6 | 游戏(games) |
7 | 惯例与协议等,例如linux文件系统,网络协议,ASCII带吗等说明 |
8 | 系统管理员可用的管理命令 |
9 | 跟内核有关的文件 |
注意:
-
加粗的比较重要
-
其实man也是一个命令,所以他也具有自己对应的man page ,查询时候直接输入man man即可
NAME
NAME <==这个命令的完整全名,如下所示为date且说明简单用途为配置与显示日期/时间
date - print or set the system date and time
- Name这里表示命令的完整全名,并且给出相应的简短说明
SYNOPSIS
SYNOPSIS <==这个命令的基本语法如下所示
date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
- SYNOPSIS这里表示命令的语法(syntax)的简介
DESCRIPTION
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)
....(中间省略)....
-
这个部分首先给出了这个命令的详细介绍
-
然后给出了针对前面语法中给出的选项与参数进行说明
COMMANDS
这个部分给出了当程序(软件)正在之行时候,可以在这个程序(软件)中执行的命令
注:
- date命令的man page并没有这一部分
FILES
这个程序或者数据所使用的或参考或链接到的文件
SEE ALSO
SEE ALSO <==这个重要,你还可以从哪里查到与date相关的说明文件之意
The full documentation for date is maintained as a Texinfo manual.
If the info and date programs are properly installed at your site,
the command
info date
should give you access to the complete manual.
- 这里给出和这个命令或数据相关的其他说明
EXAMPLE
example里面会给出命令的一些实例,这里没有给出
如何查看man page
浏览步骤
- 先NAME
- 再DESCRIPTION
- 然后是OPTION
- 初学者多看看EXAMPLE
- 有能力了看看FILES
特殊操作
按键 | 说明 |
---|---|
Space | 向下翻一页 |
Page Down | 向下翻一页 |
Page Up | 向上翻一页 |
Home | 回到第一页 |
End | 跳转到最后一页 |
/String | 从当前页面向下查找关键词 |
?String | 从当前页面想上寻找关键词 |
n,N | 在查找关键词时候,n是到下一个关键词出,N是到上一个关键词处 |
q | 退出当前命令或者文件的man page |