help和man查看命令帮助文档

Linux系统中,命令太多,记全几乎不太可能,但是,我们可以通过help命令获取帮助。

命令语法:

help [选项] [命令]

其中,选项内容包括如下:

-d  显示命令简短主题描述

-s 显示命令简短语法描述

例如:

输入help命令回车后内容:

[root@bogon /]# help
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

 job_spec [&]                                               history [-c] [-d offset] [n] or history -anrw [filename>
 (( expression ))                                           if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMA>
 . filename [arguments]                                     jobs [-lnprs] [jobspec ...] or jobs -x command [args]
 :                                                          kill [-s sigspec | -n signum | -sigspec] pid | jobspec >
 [ arg... ]                                                 let arg [arg ...]
 [[ expression ]]                                           local [option] name[=value] ...
 alias [-p] [name[=value] ... ]                             logout [n]
 bg [job_spec ...]                                          mapfile [-n count] [-O origin] [-s count] [-t] [-u fd] >
 bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u >  popd [-n] [+N | -N]
 break [n]                                                  printf [-v var] format [arguments]
 builtin [shell-builtin [arg ...]]                          pushd [-n] [+N | -N | dir]
 caller [expr]                                              pwd [-LP]
 case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... es>  read [-ers] [-a array] [-d delim] [-i text] [-n nchars]>
 cd [-L|-P] [dir]                                           readarray [-n count] [-O origin] [-s count] [-t] [-u fd>
 command [-pVv] command [arg ...]                           readonly [-af] [name[=value] ...] or readonly -p
 compgen [-abcdefgjksuv] [-o option]  [-A action] [-G glo>  return [n]
 complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A act>  select NAME [in WORDS ... ;] do COMMANDS; done
 compopt [-o|+o option] [-DE] [name ...]                    set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...]
 continue [n]                                               shift [n]
 coproc [NAME] command [redirections]                       shopt [-pqsu] [-o] [optname ...]
 declare [-aAfFilrtux] [-p] [name[=value] ...]              source filename [arguments]
 dirs [-clpv] [+N] [-N]                                     suspend [-f]
 disown [-h] [-ar] [jobspec ...]                            test [expr]
 echo [-neE] [arg ...]                                      time [-p] pipeline
 enable [-a] [-dnps] [-f filename] [name ...]               times
 eval [arg ...]                                             trap [-lp] [[arg] signal_spec ...]
 exec [-cl] [-a name] [command [arguments ...]] [redirect>  true
 exit [n]                                                   type [-afptP] name [name ...]
 export [-fn] [name[=value] ...] or export -p               typeset [-aAfFilrtux] [-p] name[=value] ...
 false                                                      ulimit [-SHacdefilmnpqrstuvx] [limit]
 fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [>  umask [-p] [-S] [mode]
 fg [job_spec]                                              unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMANDS; done               unset [-f] [-v] [name ...]
 for (( exp1; exp2; exp3 )); do COMMANDS; done              until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name () { COMMANDS ; }     variables - Names and meanings of some shell variables
 getopts optstring name [arg]                               wait [id]
 hash [-lr] [-p pathname] [-dt] [name ...]                  while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]                                  { COMMANDS ; }


我们通过help命令查看某个命令帮助信息:

对于其他命令也一样,使用时不知道其含义,可以通过help命令查看帮助文档,获取帮助信息。

当然了,如果使用help还解决不了问题,我们可以使用man,查看在线手册,获取更多帮助信息:

man语法命令:

man [选项] [命令]

其中常用选项如下:

-a 显示所有的手册页,不只是显示第一个

-f 只显示命令的功能,而不显示详细的说明文件,跟whatis命令相同

-w 不显示手册内容,只显示将被格式化和显示的文件所在位置

例如:

[root@bogon /]# man pwd

回车后显示内容比help pwd显示的多,是在线手册,内容更丰富。

当我们看完文档时,通过按键盘上的q键,退出在线文档阅读。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值