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只檢視配置檔案簡短幫助文件資訊

[[email protected] ~]# apropos ifconfig
ifconfig (8)         - 配置網路介面
ifcfg (8)            - simplistic script which replaces ifconfig IP management
pifconfig (8)        - display information about a network interface

3.3、命令後加–help檢視常見的命令選項資訊

[[email protected] ~]# 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 FORMAT1<newline>FORMAT2, 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 模式或者選項。