zoukankan      html  css  js  c++  java
  • 在Linux系统上获取命令帮助信息和划分man文档

    使用历史命令
    history 打完以后前面会有顺序号的比如
    1 cd
    2 ls
    3 pwd
    如果需要重新执行cd命令则可以执行 !3 命令

    命令补全功能 比如你要执行history命令 可以打上histo+键

    命令帮助信息、man
    man history


    例如查 wait 这个命令,
    [root@jcwkyl /]# man -k wait
    部分输出如下:
    wait                  (1p)  - await process completion
    wait                  (2)  - wait for process to change state
    wait                  (3p)  - wait for a child process to stop or terminate
    wait3 [wait4]         (2)  - wait for process to change state, BSD style
    wait4                (2)  - wait for process to change state, BSD style
    wait [builtins ]      (1)  - bash built-in commands, see bash(1)
    waitid                (3p)  - wait for a child process to change state
    waitpid [wait]       (2)  - wait for process to change state
    waitpid [wait]       (3p)  - wait for a child process to stop or terminate
    上述命令 man –k 等同于 apropos 命令。会看到输出的第行分三部分,最中间的部分就表示这个命令在哪一类。例如:
    wait                  (2)  - wait for process to change state
    就表示这个一个系统调用。因为分类 2 是系统调用的分类。
    man 文档分为 9 大类 :

    Section The human readable name
       1    User commands that may be started by everyone.
       2    System calls, that is, functions provided by the kernel.
       3    Subroutines, that is, library functions.
       4    Devices, that is, special files in the /dev directory.
       5    File format descriptions, e.g. /etc/passwd .
       6    Games, self-explanatory.
       7    Miscellaneous, e.g. macro packages, conventions.
       8    System administration tools that only root can execute.
       9    Another (Linux specific) place for kernel routine documentation.
       n     (Deprecated) New documentation, that may be moved to a more appropriate section.
       o     (Deprecated) Old documentation, that may be kept for a grace period.
       l     (Deprecated) Local documentation referring to this particular system.
     
    了解这些,在看一个命令的 man 文档的 see also 部分时就能猜到这个命令大概是哪一类的,是一个 bash 命令,还是一个系统调用,还是其它,等等,心里会有个数。
    曾经自己在 linux 下写一个 socket 程序,因为记不太清楚 sockaddr_in 数据结构的定义,但是又 man 不到,最后在 linuxforum 论坛上找到了答案:应该用 man 7 ip 来看。

  • 相关阅读:
    dayⅦ:元组、字典的其他操作+集合类型
    dayⅥ:作业
    dayⅥ:字符串操作+列表操作
    dayⅣ:赋值运算+if判断
    dayⅣ:赋值运算+if判断作业
    dayⅢ、基本数据类型+运算符
    爬虫解析bs4
    爬虫请求库之requests库
    爬虫原理
    各主流Linux系统解决方案pip安装mysqlclient报错
  • 原文地址:https://www.cnblogs.com/otosis/p/5914093.html
Copyright © 2011-2022 走看看