man 命令
#获取制定命令的帮助
man ls
#查看ls的帮助
运行效果:
[root@localhost ~]# man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.
Mandatory arguments to long options are mandatory for short options
too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
--author
with -l, print the author of each file
-b, --escape
print octal escapes for nongraphic characters
--block-size=SIZE
use SIZE-byte blocks. See SIZE format below
-B, --ignore-backups
do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last modification of
file status information) with -l: show ctime and sort by name
otherwise: sort by ctime
-C list entries by columns
--color[=WHEN]
colorize the output. WHEN defaults to ‘always’ or can be
‘never’ or ‘auto’. More info below
-d, --directory
list directory entries instead of contents, and do not derefer-
ence symbolic links
-D, --dired
generate output designed for Emacs’ dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify
append indicator (one of */=>@|) to entries
--file-type
likewise, except do not append ‘*’
--format=WORD
across -x, commas -m, horizontal -x, long -l, single-column -1,
verbose -l, vertical -C
--full-time
like -l --time-style=full-iso
-g like -l, but do not list owner
--group-directories-first
group directories before files.
augment with a --sort option, but any use of --sort=none (-U)
disables grouping
-G, --no-group
in a long listing, don’t print group names
-h, --human-readable
with -l, print sizes in human readable format (e.g., 1K 234M 2G)
--si likewise, but use powers of 1000 not 1024
-H, --dereference-command-line
follow symbolic links listed on the command line
--dereference-command-line-symlink-to-dir
follow each command line symbolic link that points to a direc-
tory
--hide=PATTERN
do not list implied entries matching shell PATTERN (overridden
by -a or -A)
--indicator-style=WORD
append indicator with style WORD to entry names: none (default),
slash (-p), file-type (--file-type), classify (-F)
-i, --inode
print the index number of each file
-I, --ignore=PATTERN
do not list implied entries matching shell PATTERN
-k like --block-size=1K
-l use a long listing format
-L, --dereference
when showing file information for a symbolic link, show informa-
tion for the file the link references rather than for the link
itself
-m fill width with a comma separated list of entries
-n, --numeric-uid-gid
like -l, but list numeric user and group IDs
-N, --literal
print raw entry names (don’t treat e.g. control characters spe-
cially)
-o like -l, but do not list group information
-p, --indicator-style=slash
append / indicator to directories
-q, --hide-control-chars
print ? instead of non graphic characters
--show-control-chars
show non graphic characters as-is (default unless program is
‘ls’ and output is a terminal)
-Q, --quote-name
enclose entry names in double quotes
--quoting-style=WORD
use quoting style WORD for entry names: literal, locale, shell,
shell-always, c, escape
-r, --reverse
reverse order while sorting
-R, --recursive
list subdirectories recursively
-s, --size
print the allocated size of each file, in blocks
-S sort by file size
--sort=WORD
sort by WORD instead of name: none -U, extension -X, size -S,
time -t, version -v
--time=WORD
with -l, show time as WORD instead of modification time: atime
-u, access -u, use -u, ctime -c, or status -c; use specified
time as sort key if --sort=time
--time-style=STYLE
with -l, show times using style STYLE: full-iso, long-iso, iso,
locale, +FORMAT. FORMAT is interpreted like ‘date’; if FORMAT
is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent files
and FORMAT2 to recent files; if STYLE is prefixed with ‘posix-’,
STYLE takes effect only outside the POSIX locale
-t sort by modification time
-T, --tabsize=COLS
assume tab stops at each COLS instead of 8
-u with -lt: sort by, and show, access time with -l: show access
time and sort by name otherwise: sort by access time
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-w, --width=COLS
assume screen width instead of current value
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-1 list one file per line
SELinux options:
--lcontext
Display security context. Enable -l. Lines will probably be
too wide for most displays.
-Z, --context
Display security context so it fits on most displays. Displays
only mode, user, group, security context and file name.
--scontext
Display only security context and file name.
--help display this help and exit
--version
output version information and exit
SIZE may be (or may be an integer optionally followed by) one of fol-
lowing: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T,
P, E, Z, Y.
Using color to distinguish file types is disabled both by default and
with --color=never. With --color=auto, ls emits color codes only when
standard output is connected to a terminal. The LS_COLORS environment
variable can change the settings. Use the dircolors command to set it.
Exit status:
0 if OK,
1 if minor problems (e.g., cannot access subdirectory),
2 if serious trouble (e.g., cannot access command-line argument).
AUTHOR
Written by Richard M. Stallman and David MacKenzie.
REPORTING BUGS
Report ls bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report ls translation bugs to <http://translationproject.org/team/>
COPYRIGHT
Copyright © 2010 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
The full documentation for ls is maintained as a Texinfo manual. If
the info and ls programs are properly installed at your site, the com-
mand
info coreutils 'ls invocation'
should give you access to the complete manual.
GNU coreutils 8.4 June 2012 LS(1)
(END)
查看命令拥有那个级别的帮助
man -f 命令
相当于
whatis 命令
举例:
man -5 passwd
man -4 null
man -8 ifconfig
查看和命令相关的所有帮助
man -k 命令
相当于
apropos 命令
例如:
apropos passwd
运行效果:
[root@localhost ~]# apropos passwd
chpasswd (8) - update passwords in batch mode
fgetpwent_r [getpwent_r] (3) - get passwd file entry reentrantly
getpwent_r (3) - get passwd file entry reentrantly
gpasswd (1) - administer /etc/group and /etc/gshadow
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
pam_passwdqc (8) - Password quality-control PAM module
passwd (1) - update user's authentication tokens
passwd (5) - password file
passwd [sslpasswd] (1ssl) - compute password hashes
passwd2des [xcrypt] (3) - RFS password encryption
passwd_selinux (8) - Security Enhanced Linux Policy for the passwd processes
saslpasswd2 (8) - set a user's sasl password
smbpasswd (5) - The Samba encrypted password file
smbpasswd (8) - change a user's SMB password
userpasswd (1) - A graphical tool to allow users to change their passwords
ypchfn [yppasswd] (1) - change your password in the NIS database
ypchsh [yppasswd] (1) - change your password in the NIS database
yppasswd (1) - change your password in the NIS database
yppasswdd_selinux (8) - Security Enhanced Linux Policy for the yppasswdd processes
选项帮助
命令 --help
#获取命令选项的帮助
例如:
ls --help
运行效果:
[root@localhost ~]# ls --help
用法:ls [选项]... [文件]...
列出 FILE 的信息(默认为当前目录)。
如果不指定-cftuvSUX 或--sort 选项,则根据字母大小排序。
长选项必须使用的参数对于短选项时也是必需使用的。
-a, --all 不隐藏任何以. 开始的项目
-A, --almost-all 列出除. 及.. 以外的任何项目
--author 与-l 同时使用时列出每个文件的作者
-b, --escape 以八进制溢出序列表示不可打印的字符
--block-size=大小 块以指定大小的字节为单位
-B, --ignore-backups 不列出任何以"~"字符结束的项目
-c 配合-lt:根据ctime 排序并显示ctime(文件
状态最后更改的时间)
配合-l:显示ctime 但根据名称排序 其他情况:按ctime 排序
-C 每栏由上至下列出项目
--color[=WHEN] 控制是否使用色彩分辨文件。WHEN 可以是
"never"(默认)、"always"或"auto"其中之一
-d, --directory 当遇到目录时列出目录本身而非目录内的文件
-D, --dired 产生适合Emacs 的dired 模式使用的结果
-f 不进行排序,-aU 选项生效,-lst 选项失效
-F, --classify 加上文件类型的指示符号(*/=@| 其中一个)
--format=关键字 交错-x,逗号分隔-m,水平-x,长-l,
单栏-1,详细-l,垂直-C
--full-time 即-l --time-style=full-iso
-g 类似-l,但不列出所有者
--group-directories-first
在文件前分组目录。此选项可与--sort 一起使用,
但是一旦使用--sort=none (-U)将禁用分组
-G, --no-group 以一个长列表的形式,不输出组名
-h, --human-readable 与-l 一起,以易于阅读的格式输出文件大小
(例如 1K 234M 2G)
--si 同上面类似,但是使用1000 为基底而非1024
-H, --dereference-command-line
跟随命令行列出的符号链接
--dereference-command-line-symlink-to-dir
跟随命令行列出的目录的符号链接
--hide=PATTERN 隐藏符合PATTERN 模式的项目
(-a 或 -A 将覆盖此选项)
--indicator-style=方式 指定在每个项目名称后加上指示符号方式:
none (默认),classify (-F),file-type (-p)
-i, --inode 显示每个文件的inode 号
-I, --ignore=PATTERN 不显示任何符合指定shell PATTERN 的项目
-k 即--block-size=1K
-l 使用较长格式列出信息
-L, --dereference 当显示符号链接的文件信息时,显示符号链接所指示
的对象而并非符号链接本身的信息
-m 所有项目以逗号分隔,并填满整行行宽
-n, --numeric-uid-gid 类似 -l,但列出UID 及GID 号
-N, --literal 输出未经处理的项目名称 (如不特别处理控制字符)
-o 类似 -l,但不列出有关组的信息
-p, --indicator-style=slash 对目录加上表示符号"/"
-q, --hide-control-chars 以"?"字符代替无法打印的字符
--show-control-chars 直接显示无法打印的字符 (这是默认方式,除非调用
的程序名称是"ls"而且是在终端输出结果)
-Q, --quote-name 将条目名称括上双引号
--quoting-style=方式 使用指定的quoting 方式显示条目的名称:
literal、locale、shell、shell-always、c、escape
-r, --reverse 排序时保留顺序
-R, --recursive 递归显示子目录
-s, --size 以块数形式显示每个文件分配的尺寸
-S 根据文件大小排序
--sort=WORD 以下是可选用的WORD 和它们代表的相应选项:
extension -X status -c
none -U time -t
size -S atime -u
time -t access -u
version -v use -u
--time=WORD 和-l 同时使用时显示WORD 所代表的时间而非修改时
间:atime、access、use、ctime 或status;加上
--sort=time 选项时会以指定时间作为排序关键字
--time-style=STYLE 和-l 同时使用时根据STYLE 代表的格式显示时间:
full-iso、iso、locale、posix-iso、+FORMAT。
FORMAT 即是"date"所用的时间格式;如果FORMAT
是FORMAT1<换行>FORMAT2,FORMAT1 适用于较旧
的文件而FORMAT2 适用于较新的文件;如果STYLE
以"posix-"开头,则STYLE 仅在POSIX 语系之外
生效。
-t 根据修改时间排序
-T, --tabsize=宽度 指定制表符(Tab)的宽度,而非8 个字符
-t 按修改时间排序
-T, --tabsize=COLS 指定制表符(Tab)的宽度,而非8个字符
-u 同-lt 一起使用:按照访问时间排序并显示
同-l一起使用:显示访问时间并按文件名排序
其他:按照访问时间排序
-U 不进行排序;按照目录顺序列出项目
-v 在文本中进行数字(版本)的自然排序
-w, --width=COLS assume screen width instead of current value
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-1 list one file per line
SELinux options:
--lcontext Display security context. Enable -l. Lines
will probably be too wide for most displays.
-Z, --context Display security context so it fits on most
displays. Displays only mode, user, group,
security context and file name.
--scontext Display only security context and file name.
--help 显示此帮助信息并退出
--version 显示版本信息并退出
SIZE 可以是一个可选的整数,后面跟着以下单位中的一个:
KB 1000,K 1024,MB 1000*1000,M 1024*1024,还有 G、T、P、E、Z、Y。
使用色彩来区分文件类型的功能已被禁用,默认设置和 --color=never 同时禁用了它。
使用 --color=auto 选项,ls 只在标准输出被连至终端时才生成颜色代码。
LS_COLORS 环境变量可改变此设置,可使用 dircolors 命令来设置。
退出状态:
0 正常
1 一般问题 (例如:无法访问子文件夹)
2 严重问题 (例如:无法使用命令行参数)
请向[email protected] 报告ls 的错误
GNU coreutils 项目主页:<http://www.gnu.org/software/coreutils/>
GNU 软件一般性帮助:<http://www.gnu.org/gethelp/>
请向<http://translationproject.org/team/zh_CN.html> 报告ls 的翻译错误
要获取完整文档,请运行:info coreutils 'ls invocation'
shell内部命令帮助
help shell内部命令
#获取shell内部命令的帮助
例如:
whereis cd
#确定是否是shell内部命令
help cd
#获取内部命令帮助
详细命令帮助info
info 命令
- 回车:进入子帮助页面(带有*号标记)
- u:进入上层页面
- n:进入下一个帮助小节
- p:进入上一个帮助小节
- q:退出