help命令的功能是用于显示帮助信息,能够输出Shell内部命令的帮助内容,但对于外部命令则无法使用,需要用man或info命令进行查看了。
语法格式:help [参数] 命令名称
常用参数:
-d | 输出每个命令的简短描述 |
-s | 输出短格式的帮助信息 |
-m | 以man手册的格式显示帮助信息 |
参考实例
以默认格式显示指定命令的帮助信息:
[root@linuxcool ~]# help cd cd: cd [-L|[-P [-e]] [-@]] [dir] Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable. The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used. ………………省略部分输出信息………………
以短格式显示指定命令的帮助信息:
[root@linuxcool ~]# help -s cd cd: cd [-L|[-P [-e]] [-@]] [dir]
以简短格式显示指定命令的帮助信息:
[root@linuxcool ~]# help -d cd cd - Change the shell working directory.
以man命令格式显示指定命令的帮助信息:
[root@linuxcool ~]# help -m cd NAME cd - Change the shell working directory. SYNOPSIS cd [-L|[-P [-e]] [-@]] [dir] DESCRIPTION Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable. ………………省略部分输出信息………………