Linux下man命令的使用技巧
时间:2024-02-17 05:17:34 点击:440

  在Linux的shell下我经常要使用man命令来查看一些不熟悉的命令的使用方法。最经在shell下编程的时候,发现一些c和c++中的库函数不清楚,我都跑去网上搜索了。一不小心,我发现,原来man还可以用来查询系统库文件中的一些函数定义和使用方法。

  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]

  在shell中输入 man+数字+命令/函数 即可以查到相关的命令和函数。若不加数字,那man命令默认从数字较小的手册中寻找相关命令和函数。

  例如,本来是想寻找c标准库中的rand()函数,直接使用man rand得到的是一个rand命令的手册,直接用来产生一个随机数,这个内容在手册section 1中。如果使用man 3 rand就可以得到自己想要的库函数中rand()的用法了。

展开 ↓

最新游戏更多

最新软件更多

  • 玩家推荐
  • 游戏攻略

德才手游网 Copyright(C) 2008- lengguim.com All Rights Reserved!

皖ICP备2023018221号-2| 免责声明