目录
▼man COMMAND
man 的基本用法
[root@CentOS7 ~]$man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default). Sort
entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
...
▼man帮助手册说明:
- NAME名称及简要说明
- SYNOPSIS 用法格式说明
[ ]
可选内容
< >
必选内容
a|b
二选一
{ }
分组
...
同一内容可出现多次 - DESCRIPTION详细说明
- OPTIONS选项说明
- EXAMPLES 示例
- FILES 相关文件
- AUTHOR作者
- COPYRIGHT 版本信息
- REPORTING BUGS bug信息
- SEE ALSO其它帮助参考
▷man的章节说明
- man手册有章节之分.
章节查看:命令whatis COMMAND
的标准输出,命令后括号就是章节
[root@CentOS7 ~]$whatis passwd
passwd (1) - update user's authentication tokens
sslpasswd (1ssl) - compute password hashes
passwd (5) - password file
- 各章节的意义
章节序号 | 意义 |
---|---|
1 | Executable programs or shell commands \\可执行程序或shell命令 |
2 | System calls (functions provided by the kernel) \\系统调用 |
3 | Library calls (functions within program libraries) \\库函数 |
4 | Special files (usually found in /dev) \\特殊文件(通常为设备) |
5 | File formats \\文件格式 |
6 | Games \\游戏 |
7 | Miscellaneous \\杂项 |
8 | System administration commands \\系统管理员命令 |
9 | Kernel routines\\内核例程 |
▷man帮助命令
space or ^v or ^f or ^F : 向文件尾翻屏
b or ^b : 向文件首部翻屏
d or ^d : 向文件尾部翻半屏
u or ^u : 向文件首部翻半屏
RETURN or ^N or e or ^E or j or ^J : 向文件尾部翻一行
y or ^Y or ^P or k or ^K :向文件首部翻一行
q 退出
# :跳转至第#行
1G : 回到文件首部
G :翻至文件尾部
▷man帮助搜索
/KEYWORD
- 以KEYWORD指定的字符串为关键字,从当前位置向文件尾部搜索;不区 分字符大小写;
n: 下一个 , N:上一个
- 以KEYWORD指定的字符串为关键字,从当前位置向文件尾部搜索;不区 分字符大小写;
?KEYWORD
- 以KEYWORD指定的字符串为关键字,从当前位置向文件首部搜索;不区 分字符大小写;
n: 上一个 , N:下一个
- 以KEYWORD指定的字符串为关键字,从当前位置向文件首部搜索;不区 分字符大小写;
▼man的其它用法
1. man [章节] keyword
查看man手册页
[root@CentOS7 ~]$whatis passwd
passwd (1) - update user’s authentication tokens
sslpasswd (1ssl) - compute password hashes
passwd (5) - password file
[root@CentOS7 ~]$man 5 passwd
PASSWD(5) Linux Programmer’s Manual PASSWD(5)
NAME
passwd - password file
DESCRIPTION
The /etc/passwd file is a text file that describes user login accounts for
the system. It should have read permission allowed for all users (many util‐
ities, like ls(1) use it to map user IDs to usernames), but write access only
for the superuser.
In the good old days there was no great problem with this general read per‐
mission. Everybody could read the encrypted passwords, but the hardware was
too slow to crack a well-chosen password, and moreover the basic assumption
used to be that of a friendly user-community. These days many people run
some version of the shadow password suite, where /etc/passwd has an 'x' char‐
acter in the password field, and the encrypted passwords are in /etc/shadow,
which is readable by the superuser only.
If the encrypted password, whether in /etc/passwd or in /etc/shadow, is an
empty string, login is allowed without even asking for a password. Note that
this functionality may be intentionally disabled in applications, or config‐
urable (for example using the "nullok" or "nonull" arguments to pam_unix.so).
...
2. man –a keyword
列出所有帮助
查看完第一个ls(1)后提示
--Man-- next: ls(1p) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
按ENTER继续查看ls(1p)
[root@CentOS7 ~]$whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
[root@CentOS7 ~]$man -a ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default). Sort
entries alphabetically if none of -cftuvSUX nor --sort is specified.
...
[root@CentOS7 ~]$man -a ls
--Man-- next: ls(1p) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
LS(1P) POSIX Programmer‘s Manual LS(1P)
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux imple‐
mentation of this interface may differ (consult the corresponding Linux man‐
ual page for details of Linux behavior), or the interface may not be imple‐
mented on Linux.
NAME
ls - list directory contents
SYNOPSIS
ls [-CFRacdilqrtu1][-H | -L ][-fgmnopsx][file...]
3. man –f keyword
显示手册中的简短描述
相当于 whatis
[root@CentOS7 ~]$whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
[root@CentOS7 ~]$man -f ls
ls (1) - list directory contents
ls (1p) - list directory contents
4. man -k keyword
搜索man手册
相当于apropos
搜索的是man手册的'NAME'
字段
[root@CentOS7 ~]$man -k 'list directory'
dir (1) - list directory contents
ls (1) - list directory contents
ls (1p) - list directory contents
vdir (1) - list directory contents
[root@CentOS7 ~]$apropos 'list directory'
dir (1) - list directory contents
ls (1) - list directory contents
ls (1p) - list directory contents
vdir (1) - list directory contents
5. man –w [章节] keyword
打印man帮助文件的路径
[root@CentOS7 ~]$man -w 1 ls
/usr/share/man/man1/ls.1.gz