Linux man命令的使用方法
一:說明
Linux man命令是初學者必須要掌握的一個Linux重要命令,這個命令可以協助在學習中遇到的各種不會使用的命令問題,每個命令的不同的使用方法都可以在這裡尋找的到。現在介紹具體使用方法。
man就是manual的縮寫,用來查看系統中內建的各種參考手冊,但是手冊頁分為好幾個部分,如下所示:
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]
二: 用法:
man+數字+命令/函數
比如:man 2 exit 即可以查到相關的命令和函數
上面什麼意思呢?對應的數字分別如下解釋:
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 sleep