当我们碰到有不懂的命令或者是不知道这个函数怎么用时,linux下为我们提供了三种方法来帮助我们:help,man,info
-
通过help来查找某个命令的使用方法可以这样,比如查看ls的使用方法
ls --help -
通过man手册来查看命令和函数,这是我们在linux开发中最常用的方法,他分了九部分,每一个部分对应一个数字:
1 Executable programs or shell commands // 命令
2 System calls (functions provided by the kernel) // 系统调用,比如 man 2 open
3 Library calls (functions within program libraries) // 函数库调用
4 Special files (usually found in /dev) // 特殊文件, 比如 man 4 tty
5 File formats and conventions eg /etc/passwd // 文件格式和约定, 比如man 5 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 手册时,比如我们查的ls这个帮助,它属于命令,命令对应数字1,所以我们应该这样使用:
man 1 ls
在查找手册的时候可以用f(往后翻页),b(往前翻页来提高工作效率),q(退出)
3 .info手册,info手册会比man手册要详细,不过复杂点,我们一般开发使用man手册就足够了,但是还是得简单了解一下info手册:
-
在linux直接执行“info”命令,执行"H"命令查看快捷键
- -
info ls,也是一样查找ls 命令得使用方法,q(退出)