感谢支持
我们一直在努力

Linux的man那点事

用过linux的朋友估计没有谁不熟悉man命令,大家都知道利用它可以查看到linux绝大部分命令的使用方法(但不是全部),除了这个你还了解它什么呢?其实了解man可以查看其它命令的使用方法就掌握了它的核心,但是最近看书的时候又找到了它的一点其他信息。哈哈,你就将这篇文章当做扯谈吧!~


1. man其实是manual的缩写(不会很多人认为它是”男人”吧),表示手册、指南的意思。


2. 其实man也包含8个部分。


man1: User programs
Manual pages that describe publicly accessible commands are contained
in this chapter. Most program documentation that a user will need to
use is located here.

man2: System calls
This section describes all of the system calls (requests for the kernel
to perform operations).

man3: Library functions and subroutines
Section 3 describes program library routines that are not direct calls
to kernel services. This and chapter 2 are only really of interest to
programmers.

man4: Special files
Section 4 describes the special files, related driver functions, and
networking support available in the system. Typically, this includes
the device files found in /dev and the kernel interface to networking
protocol support.

man5: File formats
The formats for many data files are documented in the section 5. This
includes various include files, program output files, and system files.

man6: Games
This chapter documents games, demos, and generally trivial programs.
Different people have various notions about how essential this is.

man7: Miscellaneous Manual pages that are difficult to classify are
designated as being section 7. The troff and other text processing
macro packages are found here.

man8: System administration Programs used by system administrators
for system operation and maintenance are documented here. Some of
these programs are also occasionally useful for normal users.

我们平常主要用到的是man1和man5,当我们敲出man命令时,www.linuxidc.com默认的就是man1,例如man ls实际上等价的就是man 1 ls。这是最常用的,此时man会告诉我们这个命令(程序)的用法。而平常也偶尔会用到man5,比如你要查看/etc/fstab这个文件里面每一行每一列的的解释那么你就可以使用 man 5 fstab。那么你就可以得到相关解释信息。至于其他的man,估计很少会用到。




这些man的所对应的信息都是在/usr/share/man/这个目录下:


xxx@db-2:~$ ls /usr/share/man
cs  de  es  fi  fr  gl  hu  id  it  ja  ko  man1  man2  man3  man4  man5  man6  man7  man8  nl  pl  pt  pt_BR  ru  sv  tr  zh_CN  zh_TW


其实每个manx的目录下的每个文件都是程序名或者称为命令名+x+.gz组成的,你解压之后可以看到里面是文本信息。另外,我们在man查看命令使用方法时,经常会看到第一行有command(数字),还有最后的SEE ALSO部分也是command(数字)这种信息,其实括号里面的信息就是表面你可以通过man 数字 command可以查看到相关信息,比如 man mkfs。


好了。

赞(0) 打赏
转载请注明出处:服务器评测 » Linux的man那点事
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏