前面的話
在這一部分我們開始使用 man pages,也稱爲 manual pages,所有這裏的 man 不是男人的意思,是說明手冊。我們會學習 man 命令以及一些相關的命令,例如, whereis,whatis,mandb。他們可以讓我們瞭解一些命令的使用方法,使用的頻率也是比較高的。
主要內容
1.1. man $command
命令作用
查看命令的 man pages。瞭解命令的用法
使用方法
在 man 後面跟上命令的名稱
例如: man whois
操作演示
1.2. man $configfile
命令作用
查看配置文件的說明手冊
使用方法
在 man 後面跟上配置文件
例如: man xorg.conf
操作演示
1.3. man $daemon
命令作用
查看後臺程序的 man pages
使用方法
在 man 後面加上後臺程序名
例如: man rsyslogd
操作演示
1.4. man -k ( apropos )
命令作用
列出包含所給字符串的 man pages
使用方法
man 加上 -k 參數,在跟上查找的字符串
例如: man -k syslog
操作演示
1.5. whatis
命令作用
查看關於 man page 的描述。
使用方法
whatis 跟上字符串
例如: whatis route
操作演示
1.6. whereis
命令作用
查找 man page 的位置
使用方法
例如: whereis -m whois
操作演示
1.7. man 分類
我們應該有發現,man後面的圓括號裏面會有數字。每個數字表示一個分類,大家可以通過 man man查看。
源於 man man page裏面
The table below shows the section numbers of the manual followed by the types of pages they contain.
1 Executable programs or shell commands
2 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/passwd
6 Games
7 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.7. man $section $file
命令作用
訪問自己需要的 man 文件。
使用方法
如果看passwwd命令的 man page,是查看 passwd(1),當查看passwd文件則在 passwd(5)。
例如: man 5 passwd
操作演示
1.9. man man
查看 man 自己的 man page
1.10. mandb
命令作用
更新 man page 數據庫。有使用你查不到一個命令,但它的 man page 你知道它是存在的,用這個命令更新 man 的數據庫。
操作演示
版權聲明
Moriarty_221爲本文的CSDN博客
如未註明,均爲原創,轉載請註明出處
轉載請註明:Coskimö » Ubuntu終端教程01:Man Pages
版權所有 © 科斯基摩 | 本網站採用cc by-nc-sa 3.0協議進行授權