使用man手册页
一、使用man工具
(一)man机制概述
1.Linux提供的一种集中手册页文档机制
大多数程序/配置文件/库函数都提供手册页
包括命令名称、语法、用途描述、选项、作者等信息
通过统一阅读工具man来获得这些帮助
(二)使用man帮助工具
1.man,格式化手册阅读工具
用法:man 手册名称(命令或配置文件名)
NAME、SYNOPSIS、DESCRIPTION、OPTIONS
[root@localhost-localdomain ~]# man useradd
SERADD(8) 系统管理命令 USERADD(8)
名称
useradd - 创建一个新用户或更新默认新用户信息
大纲
useradd [选项] 登录
useradd -D
useradd -D [选项]
描述
When invoked without the -D option, the useradd command creates a new user
account using the values specified on the command line plus the default
values from the system. Depending on command line options, the useradd
command will update system files and may also create the new user's home
directory and copy initial files.
By default, a group will also be created for the new user (see -g, -N, -U,
and USERGROUPS_ENAB).
选项
The options which apply to the useradd command are:
-b, --base-dir BASE_DIR
The default base directory for the system if -d HOME_DIR is not
specified. BASE_DIR is concatenated with the account name to define the
home directory. If the -m option is not used, BASE_DIR must exist.
If this option is not specified, useradd will use the base directory
specified by the HOME variable in /etc/default/useradd, or /home by
default.
-c, --comment COMMENT
任何字符串。通常是关于登录的简短描述,当前用于用户全名。
……
2.基本操作
按 ↑ 、 ↓ 、PgUp、PgDn键滚动及翻页
按q 或Q 键退出
按/ 键向后查找(n、N切换)
二、man手册页的分节
(一)man手册存放位置
1.标准manual手册文档集中存放
/usr/share/share/man/……/目录
/usr/share/share/man/zh_CN/……
[root@localhost-localdomain ~]# manpath
/usr/local/share/man:/usr/share/man/overrides:/usr/share/man
(二)分节机制及入口
1.man分节入口
1用户指令、2 系统、3 程序库、4 设备、5文件系统
6 游戏、7 杂项、8 系统指令、9 内核指令
[root@localhost-localdomain ~]# ls -d /usr/share/man/man[0-9]
/usr/share/man/man1 /usr/share/man/man4 /usr/share/man/man7
/usr/share/man/man2 /usr/share/man/man5 /usr/share/man/man8
/usr/share/man/man3 /usr/share/man/man6 /usr/share/man/man9
2.选择指定的入口
man 节号 手册名称
[root@localhost-localdomain ~]# man 5 passwd
PASSWD(5) File formats PASSWD(5)
NAME 名称
passwd - 密码文件
描述
Passwd 是个文本文件, 它包含了一个系统帐户列表,
给出每个帐户一些有用的信息,比如用户 ID,组 ID, 家目录, shell,等.
通常它也包含了每个用户经过加密的密码.
它通常应该是可读的(许多命令,工具程序,象 ls(1) 用它做用户 Id
到用户名称的映射),但是只允许超级用户有写方式权限.
在过去美好的日子里,这种一般的读许可没有什么大问题.
每个人都能读到加密了的密码,因为硬件太慢以至于不能解开一个
精选的密码,另外,这基本假定是为友好的使用团体使用的.
现在,许多人运行一些版本的影子密码套件,它们在 /etc/passwd 的密码域里是
*,而不再是加密的口令, 加密的口令放在 /etc/shadow
中,那个文件只有超级用户能读.
不管是否使用了影子密码,许多系统管理员使用一个星号在加密的密码字段
以确保用户不能鉴别他(她)自己的密码. (见下面的注意)
如果你建立了一个新的登录,首先放个星号在密码字段, 然后使用 passwd(1) 设置它.
……
三、whatis手册索引
(一)whatis手册索引
1.使用mandb工具
而 CentOS 6.9 及之前的系统使用 makewhatis 命令,CentOS 7 系统要使用 mandb命令来更新 man db
[root@localhost-localdomain ~]# makewhatis // CentOS 6.9
bash: makewhatis: 未找到命令...
[root@localhost-localdomain ~]# mandb // CentOS 7
正在删除 /usr/share/man 里的旧数据库条目...
mandb: 警告:/usr/share/man/man8/fsck.fat.8.manpage-fix.gz:忽略错误的文件名
正在处理 /usr/share/man 下的手册页...
正在删除 /usr/share/man/en 里的旧数据库条目...
正在处理 /usr/share/man/en 下的手册页...
正在删除 /usr/share/man/fr 里的旧数据库条目...
正在处理 /usr/share/man/fr 下的手册页...
正在删除 /usr/share/man/zh_TW 里的旧数据库条目...
正在处理 /usr/share/man/zh_TW 下的手册页...
正在删除 /usr/share/man/it 里的旧数据库条目...
正在处理 /usr/share/man/it 下的手册页...
正在删除 /usr/share/man/ja 里的旧数据库条目...
正在处理 /usr/share/man/ja 下的手册页...
正在删除 /usr/share/man/sv 里的旧数据库条目...
正在处理 /usr/share/man/sv 下的手册页...
正在删除 /usr/share/man/zh_CN 里的旧数据库条目...
正在处理 /usr/share/man/zh_CN 下的手册页...
正在删除 /usr/share/man/hu 里的旧数据库条目...
正在处理 /usr/share/man/hu 下的手册页...
正在删除 /usr/share/man/pt 里的旧数据库条目...
正在处理 /usr/share/man/pt 下的手册页...
正在删除 /usr/share/man/sk 里的旧数据库条目...
正在处理 /usr/share/man/sk 下的手册页...
正在删除 /usr/share/man/es 里的旧数据库条目...
正在处理 /usr/share/man/es 下的手册页...
正在删除 /usr/share/man/overrides 里的旧数据库条目...
正在处理 /usr/share/man/overrides 下的手册页...
正在删除 /usr/share/man/pt_BR 里的旧数据库条目...
正在处理 /usr/share/man/pt_BR 下的手册页...
正在删除 /usr/share/man/nl 里的旧数据库条目...
正在处理 /usr/share/man/nl 下的手册页...
正在删除 /usr/share/man/tr 里的旧数据库条目...
正在处理 /usr/share/man/tr 下的手册页...
正在删除 /usr/share/man/uk 里的旧数据库条目...
正在处理 /usr/share/man/uk 下的手册页...
正在删除 /usr/share/man/de 里的旧数据库条目...
正在处理 /usr/share/man/de 下的手册页...
正在删除 /usr/share/man/pl 里的旧数据库条目...
正在处理 /usr/share/man/pl 下的手册页...
正在删除 /usr/share/man/id 里的旧数据库条目...
正在处理 /usr/share/man/id 下的手册页...
正在删除 /usr/share/man/ko 里的旧数据库条目...
正在处理 /usr/share/man/ko 下的手册页...
正在删除 /usr/share/man/cs 里的旧数据库条目...
正在处理 /usr/share/man/cs 下的手册页...
正在删除 /usr/share/man/ru 里的旧数据库条目...
正在处理 /usr/share/man/ru 下的手册页...
正在删除 /usr/share/man/ca 里的旧数据库条目...
正在处理 /usr/share/man/ca 下的手册页...
正在删除 /usr/share/man/da 里的旧数据库条目...
正在处理 /usr/share/man/da 下的手册页...
正在删除 /usr/local/share/man 里的旧数据库条目...
正在处理 /usr/local/share/man 下的手册页...
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.
(二)查询手册列表
1.使用whatis工具
用法:whatis 手册名称
[root@localhost-localdomain ~]# whatis passwd
passwd (5) - (未知的主题)
sslpasswd (1ssl) - compute password hashes
passwd (1) - update user's authentication tokens