Linux 自带的帮助命令是最准确、最可靠的资料。很多其他途径搜索到的信息都不准确,甚至是错误的。所以,虽然 Linux 自带的帮助命令是英文的,但是我们要静下心来慢慢学习。
man 是最常见的帮助命令,也是 Linux 最主要的帮助命令.
命令名称:man。
英文原意:format and display the on-line manual pages。
所在路径:/usr/bin/man。
执行权限:所有用户。
功能描述:显示联机帮助手册。
[root@localhost ~]# man [选项]命令
选项
-f:査看命令拥有哪个级别的帮助
-k: 査看和命令相关的所有帮助
[root@VM_0_10_centos test]# man ls #查看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 dereference 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
上箭头 向上移动一行
下箭头 向下移动一行
PgUp 向上翻一页
PgDn 向下翻一页
g 移动到第一页
G 移动到最后一页
q 退出
/字符串 从当前页向下搜索字符串
?字符串 从当前页向上搜索字符串
n 当搜索字符串时,可以使用n键找到下一个字符串
N 当搜索字符串时,使用N键反向查询字符串。也就是说,如果使用“/字符串”方式搜索, 则N键表示向上搜索字符串;如果使用“?字符串”方式搜索,则N键表示向下搜索字符串
不知道大家有没有注意到,在执行 man 命令时,命令的开头会有一个数字标识这个命令的帮助级别
LS(1) User Commands LS(1)
#这里(1)就表示这是 ls 的 1 级别的帮助信息
级别的含义
1 普通用户可以执行的系统命令和可执行文件的帮助
2 内核可以调用的函数和工具的帮助
3 C语言函数的帮助
4 设备和特殊文件的帮助
5 配置文件的帮助
6 游戏的帮助(个人版的Linux中是有游戏的)
7 杂项的帮助
8 超级用户可以执行的系统命令的帮助
9 内核的帮助