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