前面的话
在这一部分我们开始使用 man pages,也称为 manual pages,所有这里的 man 不是男人的意思,是说明手册。我们会学习 man 命令以及一些相关的命令,例如, whereis,whatis,mandb。他们可以让我们了解一些命令的使用方法,使用的频率也是比较高的。
主要内容
1.1. man $command
命令作用
查看命令的 man pages。了解命令的用法
使用方法
在 man 后面跟上命令的名称
例如: man whois
操作演示
1.2. man $configfile
命令作用
查看配置文件的说明手册
使用方法
在 man 后面跟上配置文件
例如: man xorg.conf
操作演示
1.3. man $daemon
命令作用
查看后台程序的 man pages
使用方法
在 man 后面加上后台程序名
例如: man rsyslogd
操作演示
1.4. man -k ( apropos )
命令作用
列出包含所给字符串的 man pages
使用方法
man 加上 -k 参数,在跟上查找的字符串
例如: man -k syslog
操作演示
1.5. whatis
命令作用
查看关于 man page 的描述。
使用方法
whatis 跟上字符串
例如: whatis route
操作演示
1.6. whereis
命令作用
查找 man page 的位置
使用方法
例如: whereis -m whois
操作演示
1.7. man 分类
我们应该有发现,man后面的圆括号里面会有数字。每个数字表示一个分类,大家可以通过 man man查看。
源于 man man page里面
The table below shows the section numbers of the manual followed by the types of pages they contain.
1 Executable programs or shell commands
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 and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g.man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
1.7. man $section $file
命令作用
访问自己需要的 man 文件。
使用方法
如果看passwwd命令的 man page,是查看 passwd(1),当查看passwd文件则在 passwd(5)。
例如: man 5 passwd
操作演示
1.9. man man
查看 man 自己的 man page
1.10. mandb
命令作用
更新 man page 数据库。有使用你查不到一个命令,但它的 man page 你知道它是存在的,用这个命令更新 man 的数据库。
操作演示
版权声明
Moriarty_221为本文的CSDN博客
如未注明,均为原创,转载请注明出处
转载请注明:Coskimö » Ubuntu终端教程01:Man Pages
版权所有 © 科斯基摩 | 本网站采用cc by-nc-sa 3.0协议进行授权