man 命令的使用
man page
man 指的是manual(操作说明),用来查询命令的使用方法。man page是查询后显示的说明页。
[liusongle@centos /]$ man date
# 下面显示的内容即man page
# date后面的(1)表示的是一般用户可以使用的命令
DATE(1) User Commands DATE(1)
NAME
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.
Mandatory arguments to long options are mandatory for short options too.
-d, --date=STRING
display time described by STRING, not 'now'
-f, --file=DATEFILE
like --date once for each line of DATEFILE
-I[TIMESPEC], --iso-8601[=TIMESPEC]
output date/time in ISO 8601 format. TIMESPEC='date' for date only
(the default), 'hours', 'minutes', 'seconds', or 'ns' for date and
time to the indicated precision.
在查询结果的第一行DATE(1)后面的(1)表示的是一般用户可以使用的命令。其它常见的几个数字的意义为:
1:使用者在shell环境中可以操作的命令或者可运行文件
2:系统核心可以调用的函数与工具等
3:一些常用的函数(function)与函式库(library),大部分为C的函式库(libc)
4:装置文件的说明,通常在/dev下的文件
5:配置文件或者是某些文件的格式
6:游戏(games)
7:惯例与协议等,例如Linux文件系统、网络协议、ASCII code等等的说明
8:系统管理员可用的管理命令
9:跟kernel有关的文件
IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8)
# IFCONFIG 即为系统管理员使用的管理命令
NAME
ifconfig - configure a network interface
SYNOPSIS
ifconfig [-v] [-a] [-s] [interface]
ifconfig [-v] interface [aftype] options | address ...
NOTE
This program is obsolete! For replacement check ip addr and ip link. For
statistics use ip -s link.
......
man page的内容分为以下基本分来介绍查询的命令:
NAME | 简短的命令、数据名称说明 |
---|---|
SYNOPSIS | 简短的命令下达语法(syntax)简介 |
DESCRIPTION | 较为完整的说明,这部分最好仔细看看! |
OPTIONS | 针对 SYNOPSIS 部分中,有列举的所有可用的选项说明 |
COMMANDS | 当这个程序(软件)在运行的时候,可以在此程序(软件)中下达的命令 |
FILES | 这个程序或数据所使用或参考或连结到的某些文件 |
SEE ALSO | 可以参考的,跟这个命令或数据有相关的其他说明! |
EXAMPLE | 一些可以参考的范例 |
BUGS | 是否有相关的臭虫! |
如果要对man page的内容翻页,可以按空格键;要退出man page,则按q退出;按Home键可以去到第一页,End键可以去到最后一页。输入/string向下搜寻关键词;如果以 /string搜寻字符串, 那么可以 n 继续往下查询,用 N 往上查询。若以 ?string 向上查询字符串, 那我可以用 n 继续向上查询,用 N 反向查询。