zoukankan      html  css  js  c++  java
  • Linux 命令

    man 命令是 Linux 中最常用的命令,碰到任何让你疑惑的命令,都可以 man 一下来查看详情。不只是 shell 命令,C 语言库函数和系统调用等内容也可以通过 man 命令查看。

    man 命令默认查看的是 shell 命令的文档,可以指定参数 2 查看系统调用,3 查看 C 库函数(需要提前安装)。可以在 Linux 中直接输入 man man 查看 man 命令的帮助文档,最常用的就是查看 shell 命令、系统调用和库函数,例如:

    man printf
    man 2 open
    man 3 printf
    

    man 文档:

    NAME
           man - an interface to the on-line reference manuals
    
    SYNOPSIS
           man  [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I] [--regex|--wildcard]
           [--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation] [--no-justification]  [-p  string]  [-t]  [-T[device]]
           [-H[browser]] [-X[dpi]] [-Z] [[section] page[.section] ...] ...
           man -k [apropos options] regexp ...
           man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
           man -f [whatis options] page ...
           man  -l  [-C  file]  [-d]  [-D]  [--warnings[=warnings]]  [-R  encoding] [-L locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]]
           [-H[browser]] [-X[dpi]] [-Z] file ...
           man -w|-W [-C file] [-d] [-D] page ...
           man -c [-C file] [-d] [-D] page ...
           man [-?V]
    
    DESCRIPTION
           man is the system's manual pager.  Each page argument given to man is normally the name of a program, utility or function.  The manual page associated  with
           each  of  these  arguments  is  then  found and displayed.  A section, if provided, will direct man to look only in that section of the manual.  The default
           action is to search in all of the available sections following a pre-defined order ("1 n l 8 3 2 3posix 3pm 3perl 3am 5 4 9 6 7" by default, unless overrid‐
           den by the SECTION directive in /etc/manpath.config), and to show only the first page found, even if page exists in several sections.
    
           The table below shows the section numbers of the manual followed by the types of pages they contain.
    
           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]
    
           A manual page consists of several sections.
    

    安装 man 手册

    各大 Linux 发行版默认带了 shell 命令的 man 文档,其他文档需要自己下载。

    安装最新版本的 man 手册

    官方下载链接:https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/ 。在 man-pages-posix 文件夹下,有 POSIX 的 man 手册。

    wget https://www.kernel.org/pub/linux/docs/man-pages/man-pages-4.16.tar.gz
    tar -xvzf man-pages-4.16.tar.gz
    cd man-pages-4.16
    make install
    

    当然也可以用 Linux 发行版自带的仓库安装,例如 Ubuntu:

    apt-get install manpages
    

    安装 C 库函数手册

    首先执行下面的命令,如果报错找不到文档,则说明没有安装:

    man 3 printf
    

    Ubuntu 下需要一个个单独安装,或用通配符一次安装:

    apt-get install manpages-dev
    apt-get install manpages*
    

    CentOS 则可以一次安装:

    yum install man-pages
    

    Linux 下 C 库函数的 man 手册的说明

    • manpages:Linux 的基本命令的用法,针对 Linux 用户
    • manpages-dev:Linux 及 C 标准库的 API,针对 Linux 开发者
    • manpages-posix:POSIX 标准接口
    • manpages-posix-dev:POSIX 的头文件和函数库的用法
  • 相关阅读:
    使用日历控件的一些体会(downmoon)
    带附加条件的NewID()用法
    微软的招聘哲学——做微软人的五大核心素质(摘自《微软360度》)
    彻底禁用fckEditor的上传功能(含防止Type漏洞问题)
    Remote Access Connection Manager 服务因下列错误而停止解决办法
    GridView如何更新批量数据和单条记录?
    .net1.1与.net2.0在加载ascx文件的控件时有所不同(Downmoon)
    牛羊吃草问题求解(downmoon)
    c#操作ecxel的一些资源(downmoon搜集)
    安装sql2008 enterprise (English正式版)图解
  • 原文地址:https://www.cnblogs.com/kika/p/10851505.html
Copyright © 2011-2022 走看看