linux常用帮助命令man、whatis、apropos、--help、help+命令,whatisapropos


Linux帮助命令

man命令在内部是使用more来查看帮助文件的,所以可以使用more命令的一些快捷键
当命令和配置文件名相同时,可以通过man 1 passwd查看命令帮助,man 5 passwd查看配置文件帮助

这里写图片描述

两种帮助文件(命令和配置文件相同时)
1.命令的帮助
5.配置文件的帮助

一、man查看命令帮助

在man阅读命令信息下按/输入搜索内容可以在当前文本中查找,同时按n跳转到下一个查找到的内容
这里写图片描述
这里写图片描述

二、man查看配置文件帮助

不能以绝对路径查看,否则是打印文件内容

man 配置文件名

这里写图片描述

这里写图片描述

三、其他相关命令

3.1、whatis只查看命令简短帮助文档信息

[root@localhost ~]# whatis ifconfig
ifconfig (8)         - 配置网络接口

3.2、apropos只查看配置文件简短帮助文档信息

[root@localhost ~]# apropos ifconfig
ifconfig (8)         - 配置网络接口
ifcfg (8)            - simplistic script which replaces ifconfig IP management
pifconfig (8)        - display information about a network interface

3.3、命令后加–help查看常见的命令选项信息

[root@localhost ~]# ls --help
用法:ls [选项]... [文件]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all         不隐藏任何以. 开始的项目
  -A, --almost-all      列出除. 及.. 以外的任何项目
      --author          与-l 同时使用时列出每个文件的作者
  -b, --escape          以八进制溢出序列表示不可打印的字符
      --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,
                               '--block-size=M' prints sizes in units of
                               1,048,576 bytes; see SIZE format below
  -B, --ignore-backups       do not list implied entries ending with ~
  -c                         with -lt: sort by, and show, ctime (time of last
                               modification of file status information);
                               with -l: show ctime and sort by name;
                               otherwise: sort by ctime, newest first
  -C                         list entries by columns
      --color[=WHEN]         colorize the output; WHEN can be 'never', 'auto',
                               or 'always' (the default); more info below
  -d, --directory            list directories themselves, not their contents
  -D, --dired                generate output designed for Emacs' dired mode
  -f                         do not sort, enable -aU, disable -ls --color
  -F, --classify             append indicator (one of */=>@|) to entries
      --file-type            likewise, except do not append '*'
      --format=WORD          across -x, commas -m, horizontal -x, long -l,
                               single-column -1, verbose -l, vertical -C
      --full-time            like -l --time-style=full-iso
  -g                类似-l,但不列出所有者
      --group-directories-first
                             group directories before files;
                               can be augmented with a --sort option, but any
                               use of --sort=none (-U) disables grouping
  -G, --no-group        以一个长列表的形式,不输出组名
  -h, --human-readable      与-l 一起,以易于阅读的格式输出文件大小
                (例如 1K 234M 2G)
      --si          同上面类似,但是使用1000 为基底而非1024
  -H, --dereference-command-line
                             follow symbolic links listed on the command line
      --dereference-command-line-symlink-to-dir
                             follow each command line symbolic link
                               that points to a directory
      --hide=PATTERN         do not list implied entries matching shell PATTERN
                               (overridden by -a or -A)
      --indicator-style=WORD  append indicator with style WORD to entry names:
                               none (default), slash (-p),
                               file-type (--file-type), classify (-F)
  -i, --inode                print the index number of each file
  -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
  -k, --kibibytes            default to 1024-byte blocks for disk usage
  -l                使用较长格式列出信息
  -L, --dereference     当显示符号链接的文件信息时,显示符号链接所指示
                的对象而并非符号链接本身的信息
  -m                所有项目以逗号分隔,并填满整行行宽
  -n, --numeric-uid-gid     类似 -l,但列出UID 及GID 号
  -N, --literal         输出未经处理的项目名称 (如不特别处理控制字符)
  -o                类似 -l,但不列出有关组的信息
  -p,  --indicator-style=slash  对目录加上表示符号"/"
  -q, --hide-control-chars   print ? instead of nongraphic characters
      --show-control-chars   show nongraphic characters as-is (the default,
                               unless program is 'ls' and output is a terminal)
  -Q, --quote-name           enclose entry names in double quotes
      --quoting-style=WORD   use quoting style WORD for entry names:
                               literal, locale, shell, shell-always, c, escape
  -r, --reverse         逆序排列
  -R, --recursive       递归显示子目录
  -s, --size            以块数形式显示每个文件分配的尺寸
  -S                         sort by file size
      --sort=WORD            sort by WORD instead of name: none (-U), size (-S),
                               time (-t), version (-v), extension (-X)
      --time=WORD            with -l, show time as WORD instead of default
                               modification time: atime or access or use (-u)
                               ctime or status (-c); also use specified time
                               as sort key if --sort=time
      --time-style=STYLE     with -l, show times using style STYLE:
                               full-iso, long-iso, iso, locale, or +FORMAT;
                               FORMAT is interpreted like in 'date'; if FORMAT
                               is FORMAT1FORMAT2, then FORMAT1 applies
                               to non-recent files and FORMAT2 to recent files;
                               if STYLE is prefixed with 'posix-', STYLE
                               takes effect only outside the POSIX locale
  -t                         sort by modification time, newest first
  -T, --tabsize=COLS         assume tab stops at each COLS instead of 8
  -u                         with -lt: sort by, and show, access time;
                               with -l: show access time and sort by name;
                               otherwise: sort by access time
  -U                         do not sort; list entries in directory order
  -v                         natural sort of (version) numbers within text
  -w, --width=COLS           assume screen width instead of current value
  -x                         list entries by lines instead of by columns
  -X                         sort alphabetically by entry extension
  -1                         list one file per line

SELinux options:

  --lcontext                 Display security context.   Enable -l. Lines
                             will probably be too wide for most displays.
  -Z, --context              Display security context so it fits on most
                             displays.  Displays only mode, user, group,
                             security context and file name.
  --scontext                 Display only security context and file name.
      --help        显示此帮助信息并退出
      --version     显示版本信息并退出

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

3.4、help+命令 查看Shell内置命令

查不到命令路径的都是Shell内置命令

[root@localhost temp]# help umask
umask: umask [-p] [-S] [模式]
    显示或设定文件模式掩码。

    设定用户文件创建掩码为 MODE 模式。如果省略了 MODE,则
    打印当前掩码的值。

    如果MODE 模式以数字开头,则被当作八进制数解析;否则是一个
    chmod(1) 可接收的符号模式串。

    选项:
      -p    如果省略 MDOE 模式,以可重用为输入的格式输入
      -S    以符号形式输出,否则以八进制数格式输出

    退出状态:
    返回成功,除非使用了无效的 MODE 模式或者选项。

相关内容