不管是初学者学习linux还是高手使用linux都不可避免的要查看帮助,以使得命令以不同的方式工作。常用的查看帮助的方式如下:
一、whatis
简单描述命令的功能
[root@localhost ~]# whatis passwd
passwd (1) - update a user's authentication tokens(s)
passwd (5) - password file
passwd [sslpasswd] (1ssl) - compute password hashes
二、Command --help
[root@localhost ~]# passwd --help
Usage: passwd [OPTION...] <accountName>
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only)
-l, --lock lock the named account (root only)
-u, --unlock unlock the named account (root only)
-f, --force force operation
-x, --maximum=DAYS maximum password lifetime (root only)
-n, --minimum=DAYS minimum password lifetime (root only)
-w, --warning=DAYS number of days warning users receives before
password expiration (root only)
-i, --inactive=DAYS number of days after password expiration when an
account becomes disabled (root only)
-S, --status report password status on the named account (root only)
--stdin read new tokens from stdin (root only)
Help options:
-?, --help Show this help message
--usage Display brief usage message
备注:结合上面内容解释Usage中的各个符号代表的含义
(1)[]表示可选,即可有可无,其中"--"表示选项是一个单词,若选项是一个字母则用"-"
(2)<>可变的
(3)a|b|c 三者中任选一个,即三者之一
(4)-abc a b c之间的组合
三、man [<Chapter>]<Command>
每个命令都有一个manual pages,pages被封装成chapter。一共有8个chapter:
1.User command 2.System calls 3.Library calls
4.Special files 5.File formats 6.Games
7.Miscellaneous 8.Administrative commands
其中常用的有chapter 1、5、8
以ls命令为例:
[root@localhost ~]# man ls
LS(1)表示chapter 1,以此类推,但是不是每个命令都有8个chapter
直接查看passwd的chapter 5,
[root@localhost ~]# man 5 passwd
PASSWD(5)
使用man查看帮助时经常进行的操作:
(1)使用方向键上和方向键下每次一行的滚动屏幕,使用空格键、pageup向下翻页
使用pagedown向上翻页
(2)/<SearchKeyword> 搜索keyword
(3)n/N 搜索下一个/上一个关键字
(4)q 退出man
(5)man -k keyword 查询含有keyword关键字的所有命令
四、info <Command>
提供比man还有详细的解释,有些行前面有"*"表示链接
使用info查看帮助时经常进行的操作:
(1)使用方向键上和方向键下每次一行的滚动屏幕,使用空格键、pageup向下翻页
使用pagedown向上翻页
(2)按Tab键跳到下一个"*"链接,然后按Enter跳转到该链接
(3)n/p/u 下一个小节/上一个小节/上一层小节
(4)q 退出
3270

被折叠的 条评论
为什么被折叠?



