帮助命令
1. man 命令
man 是最常见的帮助命令,也是 Linux 最主要的帮助命令, 其基本信息如下。
命令名称: man。
英文原意: format and display the on-line manual pages。
所在路径: /usr/bin/man。
执行权限:所有用户。
功能描述:显示联机帮助手册。
1.1. 命令格式
[root@localhost ~]# man [选项] 命令
选项:
-f: 查看命令拥有哪个级别的帮助
-k: 查看和命令相关的所有帮助
1.2. man 命令的快捷键
| 快 捷 键 | 作 用 |
| 上箭头 | 向上移动一行 |
| 下箭头 | 向下移动一行 |
| PgUp | 向上翻一页 |
| PgDn | 向下翻一页 |
| g | 移动到第一页 |
| G | 移动到最后一页 |
| q | 退出 |
| /字符串 | 从当前页向下搜索字符串 |
| ?字符串 | 从当前页向上搜索字符串 |
| n | 当搜索字符串时,可以使用 n 键找到下一个字符串 |
| N | 当搜索字符串时,使用 N 键反向查询字符串。也就是说,如果使用“/字符串”方式搜索, 则 N 键 表示向上搜索字符串;如果使用“?字符串”方式搜索, 则 N 键表示向下搜索字符串 |
1.3. man 命令的帮助级别
| 级 别 | 作 用 |
| 1 | 普通用户可以执行的系统命令和可执行文件的帮助 |
| 2 | 内核可以调用的函数和工具的帮助 |
| 3 | C 语言函数的帮助 |
| 4 | 设备和特殊文件的帮助 |
| 5 | 配置文件的帮助 |
| 6 | 游戏的帮助(个人版的 Linux 中是有游戏的) |
| 7 | 杂项的帮助 |
| 8 | 超级用户可以执行的系统命令的帮助 |
| 9 | 内核的帮助 |
[root@iZbp143t3oxhfc3ar7jey0Z ~]# man ls [root@iZbp143t3oxhfc3ar7jey0Z ~]# man 5 passwd No manual entry for passwd in section 5 [root@iZbp143t3oxhfc3ar7jey0Z ~]# man -f passwd passwd (1) - update user's authentication tokens sslpasswd (1ssl) - compute password hashes [root@iZbp143t3oxhfc3ar7jey0Z ~]# whatis passwd passwd (1) - update user's authentication tokens sslpasswd (1ssl) - compute password hashes [root@iZbp143t3oxhfc3ar7jey0Z ~]# makewhatis -bash: makewhatis: command not found [root@iZbp143t3oxhfc3ar7jey0Z ~]# man -k ls SSL (3ssl) - OpenSSL SSL/TLS library blockdev (8) - call block device ioctls from the command line BN_lshift (3ssl) - bit operations on BIGNUMs BN_lshift1 (3ssl) - bit operations on BIGNUMs c++filt (1) - Demangle C++ and Java symbols. charnames (3pm) - access to Unicode character names an
man -f 命令 或 whatis 命令 #查看命令拥有哪个级别的帮助 man -k 命令 或 apropos 命令 #查看和命令相关的所有帮助
2. info 命令
info 命令的帮助信息是一套完整的资料,每个单独命令的帮助信息只是这套完整资料中的某一个小章节。
| 快 捷 键 | 作 用 |
| 上箭头 | 向上移动一行 |
| 下箭头 | 向下移动一行 |
| PgUp | 向上翻一页 |
| PgDn | 向下翻一页 |
| Tab | 在有“*”符号的节点间进行切换 |
| 回车 | 进入有“*”符号的子页面,查看详细帮助信息 |
| u | 进入上一层信息(回车是进入下一层信息) |
| n | 进入下一小节信息 |
| p | 进入上一小节信息 |
| ? | 查看帮助信息 |
| q | 退出 info 信息 |
3. help 命令
help 只能获取 Shell 内置命令的帮助
help 命令的基本信息如下。
命令名称: help。
英文原意: help。
所在路径: Shell 内置命令。
执行权限:所有用户。
功能描述:显示 Shell 内置命令的帮助。可以使用 type 命令来区分内置命令与外部命令
shell 是 Linux 的命令解释器。
4. --help 选项
绝大多数命令都可以使用“ --help”选项来查看帮助,这也是一种获取帮助的方法。例如:
[root@iZbp143t3oxhfc3ar7jey0Z ~]# ls --help Usage: ls [OPTION]... [FILE]... 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 .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576 bytes; see SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name;
这种方法非常简单,输出的帮助信息基本上是 man 命令的信息简要版。

浙公网安备 33010602011771号