linux中man的使用
man里通常包含以下分段
1 Executable programs or shell commands
2 System calls
3 Library calls
4 Special files (usually found in /dev)
5 File formats and conventions
6 Games
7 Miscellaneous
8 System administration commands
9 Nonstandard kernel routines
n New documentation, which may be moved later
l Local documentation, specific to your system
每个分段就是一个分类,有些关键字可能在一个分类中,有些则在多个分类中。
查找在第一个分段中的grep的信息
man 1 grep
查找grep在哪些分段中有信息
man 1 grep
查找命令,如字数统计
apropos count words
man -k count words
用apropos和 man -k的效果是一样的。
如果man的数据库损坏了,就可能不能查找信息了,这时可以直接查找该项的man数据
$ whereis -m cat
然后用man读出
$ man /usr/share/man/man1/cat.1.gz
如果还是不行,可以尝试重建数据库
# mandb
重建如果失效,使用这种方法查找
$ locate / cat. | egrep -w ‘cat\.[1-9][a-zA-Z]*[.gz]?’
不使用man浏览器浏览man中的内容
$ zcat /usr/share/man/man1/cat.1.gz | nroff -man | less
还有一种比较恐怖的浏览方式
zless /usr/share/man/man1/cat.1.gz
man的配置文件在 /etc/manpath.config
其中有这么一段,我的是这样的
# every automatically generated MANPATH includes these fields
#
#MANDATORY_MANPATH /usr/src/pvm3/man
#
MANDATORY_MANPATH /usr/man
MANDATORY_MANPATH /usr/share/man
MANDATORY_MANPATH /usr/X11R6/man
MANDATORY_MANPATH /usr/local/man
可以自己添加路径的。
$ manpath用来查看所有的man路径。
用本地打印机打印man中的页,如
$ man -t finger | lpr
使用网络打印机打印man中的页,如
$ man -t finger | lpr -P printername
打印信息页
$ info finger | lpr
$ info finger | lpr -o cpi=12 -o page-left=54 -o page-right=54 -o page-top=54 \ -o page-bottom=54
将man中的信息导出到文件
$ man bash | col -b > bash.txt
$ info bash | col -b > bash.txt

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home