linux-man

inux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找,只要man一下即可。Linux的man手册共有以下几个章节:1 Executable programs or shell commands2 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/passwd6 Games7 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、Standard commands (标准命令)2、System calls (系统调用)3、Library functions (库函数)4、Special devices (设备说明)5、File formats (文件格式)6、Games and toys (游戏和娱乐)7、Miscellaneous (杂项)8、Administrative Commands (管理员命令)9 其他(Linux特定的), 用来存放内核例行程序的文档。n 新文档, 可能要移到更适合的领域。o 老文档, 可能会在一段期限内保留。l 本地文档, 与本特定系统有关的。例如:我们输入 man ls,它会在最左上角显示“LS(1)”,在这里,“LS”表示手册名称,而“(1)”表示该手册位于第一节章,同样,我们输入“man ifconfig”它会在最左上角显示“IFCONFIG(8)”。也可以这样输入命令:“man [章节号] 手册名称”。man是按照手册的章节号的顺序进行搜索的,比如:man sleep只会显示sleep命令的手册,如果想查看库函数sleep,就要输入:man 3 sleepubuntu默认是没有安装c语言的库函数man手册的1.添加库函数手册ubuntu默认是没有安装c语言的库函数man手册的,所以你在man perror 和sendto之类的函数时会显示没有相关文档的问题,这个问题让我郁闷了我好久。解决方法:sudo apt-get install manpages-dev2.让man显示中文ubuntu源里面已经包含了中文的man包,所以不用从其他地方down了,直接sudo apt-get install manpages-zh但是这样man默认显示的还不是中文,还需要以下两步a.把中文man包转换成utf8格式的新建一个脚本文件gedit t.sh把下面内容添加进去#!/bin/bashcd /usr/share/man/zh_CN/for k in *docd $kfor i in *.gzdo j=`echo ${i%.gz}` gunzip $i iconv -f gb18030 -t utf8 $j >tmp mv tmp $j gzip $jdonecd ..done然后sudo ./tb.修改man默认的语言sudo gedit /etc/manpath.config 把里面的所有的 /usr/share/man 改成 /usr/share/man/zh_CN保存后退出,然后你再试一下man ls3.让没有中文帮助的显示英文做完上面第二部还不够,这时你再man 一下一些c语言函数(不要用printf,socket之类比较有名的函数,这些已经有中文帮助了)的时候就会发现竟然没有帮助,而刚才明明在第一步已经安装了啊。这是因为你上面 把/usr/share/man 改成 /usr/share/man/zh_CN的操作使man只在中文帮助中搜索,如果没有就直接放弃,因此还需要以下操作,才能让man在没有中文帮助的时候自动显示英文的帮助,如果英文的也没有,哪就真的没有了。sudo gedit /etc/manpath.config然后搜索你刚才改过的地方,然后在其后面添加同样的一行,只是后面的目录还用原来的/usr/share/man,比如在修改后的MANPATH_MAP /bin /usr/share/man/zh_CN再添加一行MANPATH_MAP /bin /usr/share/man新安装了ubuntu 8.04版本,发现安装过的系统中缺少很多手册页。用以下命令搞定了sudo apt-get install manpagessudo apt-get install manpages-desudo apt-get install manpages-de-devsudo apt-get install manpages-dev也就越容易失败,还不如怀揣一颗平常心,“但行好事,莫问前程”,往往成功的几率反而更大些

linux-man

相关文章:

你感兴趣的文章:

标签云: