码迷,mamicode.com
首页 > 其他好文 > 详细

如何快速掌握man手册的使用

时间:2017-10-20 10:22:22      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:难点   mes   快速   printing   一个   搜索   hat   答案   用途   

man手册内容详细,解释到位,因为好多都是软件的原创者自己写的说明文档,当然是第一手的资料。但是,有几个难点需要克服:

1、英文不易阅读,通常我是先在书上或者网络上找到某个命令的详细说明和解释,然后在通过man手册查看该命令,通俗的讲:带着答案看问题的方法。勉强能够读懂,下一次再次忘记了该命令的用法,直接看man手册(毕竟方便嘛),如果又看不懂了,在查书和网络,把看不懂的地方反复强化,几次后基本就能明白man的英文语义了。

2、不会使用man。其实只有几个常用的命令:

man -f 命令名      //用一句话描述该命令的用途,等同于”whatis“命令,例如:

fly@noi:~$ man grep
fly@noi:~$ man -f grep
grep (1)             - print lines matching a pattern
fly@noi:~$ whatis grep
grep (1)             - print lines matching a pattern
fly@noi:~$ 

man -k 命令名    //显示所有包含该命令名的所有命令

fly@noi:~$ man -k grep
bzegrep (1)          - search possibly bzip2 compressed files for a regular expression
bzfgrep (1)          - search possibly bzip2 compressed files for a regular expression
bzgrep (1)           - search possibly bzip2 compressed files for a regular expression
egrep (1)            - print lines matching a pattern
fgrep (1)            - print lines matching a pattern
git-grep (1)         - Print lines matching a pattern
grep (1)             - print lines matching a pattern
grepdiff (1)         - show files modified by a diff containing a regex
lzegrep (1)          - search compressed files for a regular expression
lzfgrep (1)          - search compressed files for a regular expression
lzgrep (1)           - search compressed files for a regular expression
msggrep (1)          - pattern matching on message catalog
pgrep (1)            - look up or signal processes based on name and other attributes
ptargrep (1)         - Apply pattern matching to the contents of files in a tar archive
rgrep (1)            - print lines matching a pattern
xzegrep (1)          - search compressed files for a regular expression
xzfgrep (1)          - search compressed files for a regular expression
xzgrep (1)           - search compressed files for a regular expression
zegrep (1)           - search possibly compressed files for a regular expression
zfgrep (1)           - search possibly compressed files for a regular expression
zgrep (1)            - search possibly compressed files for a regular expression
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern
fly@noi:~$ 

3、搜索指定章节的关键字,下面的echo在第1和8章都有,如果我想找第1章的:

fly@noi:~$ man -k echo
echo (1)             - display a line of text
l2ping (1)           - Send L2CAP echo request and receive answer
lessecho (1)         - expand metacharacters
pam_echo (8)         - PAM module for printing text messages
ping (8)             - send ICMP ECHO_REQUEST to network hosts
ping6 (8)            - send ICMP ECHO_REQUEST to network hosts
xmessage (1)         - display a message or query in a window (X-based /bin/echo)
fly@noi:~$ man -s 1 -k echo
echo (1)             - display a line of text
l2ping (1)           - Send L2CAP echo request and receive answer
lessecho (1)         - expand metacharacters
xmessage (1)         - display a message or query in a window (X-based /bin/echo)
fly@noi:~$ 

4、如果同一个命令,几个章都有,可以指定章号来显示:

fly@noi:~$ man -f printf
printf (1)           - format and print data
printf (3)           - formatted output conversion
fly@noi:~$ man 3 printf    //这样就可以显示第3章的了,否则默认是第1章

5、在man手册页内,也查找指定参数:

比如:我想找grep的--color参数的用法:

/--color   //注意:如果有很多选项可以在单词后面加空格在搜索

我想找grep命令中某一个单词,用"\< \>"命令,可以准确匹配一个词,词只能由字母、数字、下划线组成。

/\<n\>

 

如何快速掌握man手册的使用

标签:难点   mes   快速   printing   一个   搜索   hat   答案   用途   

原文地址:http://www.cnblogs.com/litifeng/p/7697635.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!