帮助命令:man
man 命令
获取命令的帮助
如下:
[root@localhost ~]# man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
...
其中LS(1)中的1表示级别。
man的级别
- 1:查看命令的帮助
- 2:查看可被内核调用的函数的帮助
- 3:查看函数和函数库的帮助
- 4:查看特殊文件的帮助(主要是/dev目录下的文件)
- 5:查看配置文件的帮助
- 6:查看游戏的帮助
- 7:查看其它杂项的帮助
- 8:查看系统管理员可用命令的帮助
- 9:查看和内核相关文件的帮助
查看命令拥有的级别
man -f 命令
whatis 命令
[root@localhost ~]# man -f ls
ls (1) - list directory contents
ls (1p) - list directory contents
[root@localhost ~]# man -f passwd
sslpasswd (1ssl) - compute password hashes
passwd (1) - update user's authentication tokens
passwd (5) - password file
[root@localhost ~]# whatis passwd
sslpasswd (1ssl) - compute password hashes
passwd (1) - update user's authentication tokens
passwd (5) - password file
[root@localhost ~]#
查看和命令有关的所有帮助
man -k 命令
apropos 命令
[root@localhost ~]# man -k passwd
chpasswd (8) - 批量更新密码
gpasswd (1) - 管理员 /etc/group 和 /etc/gshadow
fgetpwent_r (3) - get passwd file entry reentrantly
getpwent_r (3) - get passwd file entry reentrantly
grub2-mkpasswd-pbkdf2 (1) - Generate a PBKDF2 password hash.
kpasswd (1) - change a user's Kerberos password
lpasswd (1) - Change group or user password
lppasswd (1) - add, change, or delete digest passwords.
pam_localuser (8) - require users to be listed in /etc/passwd
passwd (1) - update user's authentication tokens
sslpasswd (1ssl) - compute password hashes
passwd (5) - password file
passwd2des (3) - RFS password encryption
pwhistory_helper (8) - Helper binary that transfers password hashes from passwd or shadow to opasswd
saslpasswd2 (8) - set a user's sasl password
smbpasswd (5) - The Samba encrypted password file
smbpasswd (8) - change a user's SMB password
[root@localhost ~]# apropos passwd
chpasswd (8) - 批量更新密码
gpasswd (1) - 管理员 /etc/group 和 /etc/gshadow
fgetpwent_r (3) - get passwd file entry reentrantly
getpwent_r (3) - get passwd file entry reentrantly
grub2-mkpasswd-pbkdf2 (1) - Generate a PBKDF2 password hash.
kpasswd (1) - change a user's Kerberos password
lpasswd (1) - Change group or user password
lppasswd (1) - add, change, or delete digest passwords.
pam_localuser (8) - require users to be listed in /etc/passwd
passwd (1) - update user's authentication tokens
sslpasswd (1ssl) - compute password hashes
passwd (5) - password file
passwd2des (3) - RFS password encryption
pwhistory_helper (8) - Helper binary that transfers password hashes from passwd or shadow to opasswd
saslpasswd2 (8) - set a user's sasl password
smbpasswd (5) - The Samba encrypted password file
smbpasswd (8) - change a user's SMB password
选项帮助:--help
命令 --help
获取命令选项的帮助
[root@localhost ~]# ls --help
shell内部命令的帮助:help
help 命令
[root@localhost ~]# help ls
-bash: help: 没有与 `ls' 匹配的帮助主题。尝试 `help help' 或者 `man -k ls' 或者 `info ls'。
[root@localhost ~]# 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.
...
Options:
-L force symbolic links to be followed
-P use the physical directory structure without following symbolic
links
-e if the -P option is supplied, and the current working directory
cannot be determined successfully, exit with a non-zero status
The default is to follow symbolic links, as if `-L' were specified.
Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.
[root@localhost ~]#
因为 ls 不是shell内部命令,所以无法用help,cd是shell内部命令,可以查看该命令的帮助。
可以用 whereis 确定是否是shell内部命令,如果不是,那么它会在/bin目录下,否者将不存在命令的路径。
查看详细命令帮助:info
info 命令
-回车:进入子帮助页面(带有*号标记)
-u:进入上层页面
-n:进入下一个帮助小节
-p:进入上一个帮助小节
-q:退出