Linux命令众多,选项更是纷繁复杂,全部记住是不可能的,所以查询帮助文档就是一个好办法!
本文主要记录了查询帮助文档方法。
- 英文原意:manual
- 执行权限:所有用户
- 语法:
man 命令或配置文件
- 未安装需要安装
man
- 支持像
more
一样,/
搜索
示例
[root@DESKTOP:~]# man ls
LS(1P) POSIX Programmer's Manual LS(1P)
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may
differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not
be implemented on Linux.
NAME
ls — list directory contents
SYNOPSIS
ls [−ikqrs] [−glno] [−A|−a] [−C|−m|−x|−1] \
[−F|−p] [−H|−L] [−R|−d] [−S|−f|−t] [−c|−u] [file...]
DESCRIPTION
For each operand that names a file of a type other than directory or symbolic link to a directory, ls shall
write the name of the file as well as any requested, associated information. For each operand that names a
Manual page ls(1p) line 1 (press h for help or q to quit)
[root@DESKTOP:~]# man services
SERVICES(5) Linux Programmer's Manual SERVICES(5)
NAME
services - Internet network services list
DESCRIPTION
services is a plain ASCII file providing a mapping between human-friendly textual names for internet services,
and their underlying assigned port numbers and protocol types. Every networking program should look into this
file to get the port number (and protocol) for its service. The C library routines getservent(3), getservby‐
- NAME :命令/配置的名字、说明
- SYNOPSIS:选项概要
- DESCRIPTION:描述信息
其它说明
查看配置帮助
有时候想查看配置文件的帮助信息,可能直接输入 man 命令
显示的不是配置信息的,而是命令的帮助。这时候可以借助 whereis
命令查询该命令的描述信息,一般 ***.5.gz
是命令配置的帮助信息。
比如,查询 passwd
配置的帮助信息,输入 whereis passwd
,可以得到描述信息,输入 man 5 passwd
,即可查看配置文件的帮助。
[root@DESKTOP:~]# whereis passwd
passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
[root@DESKTOP:~]# man 5 passwd
PASSWD(5) Linux Programmer's Manual PASSWD(5)
NAME
passwd - password file
DESCRIPTION
The /etc/passwd file is a text file that describes user login accounts for the system. It should
have read permission allowed for all users (many utilities, like ls(1) use it to map user IDs to
usernames), but write access only for the superuser.
其他命令
whatis 命令
可以查看命令帮助NAME部分的信息
apropos 命令
可以直接查看配置帮助NAME部分的信息
{/collapse-item}
{collapse-item label="help
获得shell内置命令的帮助信息"}
- 执行权限:所有用户
- 语法:
help 命令
示例
有些命令是shell内置命令,比如 umask
,直接用 man umask
是查不到有效信息的,查到的实际是 shell(bash)
的帮助信息,而非 umask
的帮助信息。
查看shell内置命令的帮助,就需要用 help
了
[root@DESKTOP:~]# 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.
{/collapse-item}
评论 (0)