命令名稱:man 命令英文原意:manual 命令所在路徑:/usr/bin/man 執行權限:全部用戶 功能描述:得到幫助信息
man [命令或配置文件]
# 查看ls命令的幫助信息 man ls 空格 下翻頁 pageup 上翻頁 上箭頭 向上 下箭頭 向下 /關鍵字 搜索(回車搜索,n往下找) # 查看/etc/services配置文件幫助文檔 man services 提示No manual entry for services 運行命令yum -y install man-pages,而後就能夠運行了 # 查看/etc/passwd配置文件的幫助文檔(不正確) man passwd 查詢出來的命令的幫助文檔,此時是不對的 whereis passwd [root@izm5e2q95pbpe1hh0kkwoiz ~]# whereis passwd passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz passwd既有命令又有配置文件,優先顯示命令的幫助文檔 1 命令的幫助文檔 5 配置文件的幫助文檔 # 查看passwd配置文件的幫助文檔 man 5 passwdwhatis
查看命令的簡單的描述信息git
# 查看ls的簡單的描述信息 whatis ls [root@izm5e2q95pbpe1hh0kkwoiz ~]# whatis ls ls (1) - list directory contentsapropos
查看配置文件的簡單的描述信息shell
# 查看services的簡單描述信息 apropos services--help
查看某個具體命令的選項信息bash
# 查看touch命令的具體選項信息 touch --help [root@izm5e2q95pbpe1hh0kkwoiz ~]# touch --help Usage: touch [OPTION]... FILE... Update the access and modification times of each FILE to the current time. A FILE argument that does not exist is created empty, unless -c or -h is supplied. A FILE argument string of - is handled specially and causes touch to change the times of the file associated with standard output. Mandatory arguments to long options are mandatory for short options too. -a change only the access time -c, --no-create do not create any files -d, --date=STRING parse STRING and use it instead of current time -f (ignored) -h, --no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can change the timestamps of a symlink) -m change only the modification time -r, --reference=FILE use this file's times instead of current time -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time --time=WORD change the specified time: WORD is access, atime, or use: equivalent to -a WORD is modify or mtime: equivalent to -m --help display this help and exit --version output version information and exit Note that the -d and -t options accept different time-date formats. GNU coreutils online help:For complete documentation, run: info coreutils 'touch invocation'info
help使用方法跟man 幾乎一致, 顯示的信息也大同小異less
命令名稱:help 命令所在路徑:shell內置命令(沒法經過which查找路徑,沒法經過man查看幫助文檔) 執行權限:全部用戶 功能描述:得到shell內置命令的幫助信息
help [命令]
# 使用man查看shell內置命令(沒法查看正確的幫助信息) man cd NAME bash, :, ., [, alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait - bash built-in commands, see bash(1) ...... # man 查詢cd查不出來正確的幫助文檔信息,相反查出來的是shell的內置命令 # 正確查看shell內置命令的幫助文檔信息,查看umask help umask [root@izm5e2q95pbpe1hh0kkwoiz ~]# help umask umask: umask [-p] [-S] [mode] Display or set file mode mask. Sets the user file-creation mask to MODE. If MODE is omitted, prints the current value of the mask. If MODE begins with a digit, it is interpreted as an octal number; otherwise it is a symbolic mode string like that accepted by chmod(1). Options: -p if MODE is omitted, output in a form that may be reused as input -S makes the output symbolic; otherwise an octal number is output Exit Status: Returns success unless MODE is invalid or an invalid option is given.