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

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\>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值