查帮助的思路
获取帮助的能力决定了技术的能力!
我们习惯上网搜索,但最准确的是官方文档。
whatis 使用数据库来显示命令的简短描述
刚安装后不可立即使用,需要制作数据库
新装的电脑没有帮助,显示nothing。
#CentOS 7 版本以后
mandb
#CentOS 6 版本之前
makewhatis
[root@centos8 ~]#whatis ls
ls: nothing appropriate.
#生成man相关数据库
[root@centos8 ~]#mandb
Processing manual pages under /usr/share/man...
Updating index cache for path `/usr/share/man/mann‘. Wait...done.
Checking for stray cats under /usr/share/man...
...省略...
0 old database entries were purged.
[root@centos8 ~]#whatis ls
ls (1) - list directory contents
[15:04:10 root@C8[ 2020-06-16DIR]#whatis rm
rm (1) - remove files or directories
rm (1p) - remove directory entries
括号里的是章节
查看内部命令的帮助:
最常用的--help
少部分命令 -h 或 -?
优先使用 --help GNU风格的软件
硬着头皮看英语
[]可选项 ...多个 | 竖线 多选1
格式说明:
系统安装和软件安装的时候,会自动将帮助文件放在man目录中
/usr/share/man/
[17:47:31 root@C8[ 2020-06-16DIR]#man -w mysql
/usr/share/man/man1/mysql.1.gz
[17:59:10 root@C8[ 2020-06-16DIR]#man -w passwd
/usr/share/man/man1/passwd.1.gz
[18:01:38 root@C8[ 2020-06-16DIR]#ls /usr/share/man
ca de hu ja man1 man2 man3p man4x man6 man7x man9 nl pt sk uk
cs es id ko man1p man2x man3x man5 man6x man8 man9x overrides pt_BR sv zh_CN
da fr it man0p man1x man3 man4 man5x man7 man8x mann pl ru tr zh_TW
man 页面分组为不同的“章节”,统称为Linux手册,man 1 man
1:用户命令
2:系统调用
3:C库调用
4:设备文件及特殊文件
5:配置文件格式
6:游戏
7:杂项
8:管理类的命令
9:Linux 内核API
程序的man帮助放在压缩包内,系统提供man命令帮助查找帮助文档
使用man 查看程序或命令,默认选择最小章节,章节不写,可能查看到的并不是想要的。
[17:18:31 root@C8[ 2020-06-16DIR]#whatis passwd
openssl-passwd (1ssl) - compute password hashes
passwd (1) - update user‘s authentication tokens
passwd (5) - password file
[17:18:40 root@C8[ 2020-06-16DIR]#man 5 passwd
#列出所有匹配的页面,使用 whatis 数据库
man -k keyword
man常用于命令参考 ,GNU工具 info 适合通用文档参考
没有参数,列出所有的页面
info 页面的结构就像一个网站
每一页分为“节点”
链接节点之前 *
info 命令格式
info [ 命令 ]
原文:https://www.cnblogs.com/bpzblog/p/13144050.html