man、info、help
文章目錄
- 1 help
- 2 man
- 3 info
man和info是獨立的命令, --help是個命令的參數(shù), 它們都是Linux中獲取幫助信息最權(quán)威,最快捷的途徑。
1 help
想查看某個命令的用法時,比如查看ls命令的用法,可以執(zhí)行:
ls --helphelp只能用于查看某個命令的用法。
2 man
man手冊既可以查看命令的用法,還可以查看函數(shù)的詳細(xì)介紹等等。它含有9大分類,如下:
| 1 | Executable programs or shell commands:可執(zhí)行程序或shell命令 | 用戶可操作的命令 |
| 2 | System calls (functions provided by the kernel) :系統(tǒng)調(diào)用 | 內(nèi)核提供的函數(shù)(查頭文件) |
| 3 | Library calls (functions within program libraries):庫調(diào)用 | 常用的函數(shù)庫 |
| 4 | Special files (usually found in /dev):特殊文件 | 在/dev下的設(shè)備文件 |
| 5 | File formats and conventions eg /etc/passwd :文件格式和約定 | 對一些文件進(jìn)行解釋,如/etc/passpd |
| 6 | Games:游戲程序 | 游戲程序 |
| 7 | Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7) :雜項 | 包括宏包和約定等 |
| 8 | System administration commands (usually only for root):系統(tǒng)管理員使用的管理命令 | 通常只有系統(tǒng)管理員root可以使用 |
| 9 | Kernel routines [Non standard] :內(nèi)核相關(guān) | Linux內(nèi)核相關(guān)文件 |
比如想查看open函數(shù)的用法時,可以直接執(zhí)行“man open”,發(fā)現(xiàn)這不是想要內(nèi)容時再執(zhí)行“man 2 open”。
在man命令中可以及時按“h”查看幫助信息了解快捷鍵。常用的快捷鍵是:
- f 往前翻一頁
- b 往后翻一頁
- /patten 往前搜
- ?patten 往后搜
3 info
就內(nèi)容來說,info手冊比man手冊編寫得要更全面,但man手冊使用起來更容易些。
以書來形容info手冊和man手冊的話,info手冊相當(dāng)于一章,里面含有若干節(jié),閱讀時你需要掌握如果從這一節(jié)跳到下一節(jié);而man手冊只相當(dāng)于一節(jié),閱讀起來當(dāng)然更容易。可以直接執(zhí)行“info”命令后,輸入“H”查看它的快捷鍵,在info手冊中,某一節(jié)被稱為“node”。
常用的快捷鍵如下:
-
Up Move up one line.
-
Down Move down one line.
-
PgUp Scroll backward one screenful.
-
PgDn Scroll forward one screenful.
-
Home Go to the beginning of this node.
-
End Go to the end of this node.
-
TAB Skip to the next hypertext link.
-
RET Follow the hypertext link under the cursor.
-
l Go back to the last node seen in this window.
-
[ Go to the previous node in the document.
-
] Go to the next node in the document.
-
p Go to the previous node on this level.
-
n Go to the next node on this level.
-
u Go up one level.
-
t Go to the top node of this document.
-
d Go to the main ‘directory’ node.
參考資料:
總結(jié)
以上是生活随笔為你收集整理的man、info、help的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 文件IO引入
- 下一篇: KahanSummation算法