$#man[zy@localhost ~]$ manls
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 is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --alldo not ignore entries starting with .
-A, --almost-all
do not list implied . and ..--author
with -l, print the author of each file
-b, --escape
Manual page ls(1) line 1(press h forhelp or q to quit)
8.2 --help
用途: 是大多数Linux命令内建的帮助选项,提供该命令的简短使用说明和可用选项列表。
用法: 直接在命令后面加上 --help,例如 ls --help。
特点: 提供的信息相对简略,适合快速查看基本用法。
$# -- help[zy@localhost ~]$ ls--help
Usage: ls[OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --alldo not ignore entries starting with .
-A, --almost-all do not list implied . and ..--author with -l, print the author of each file
SELinux options:
--lcontext Display security context. Enable -l. Lines
will probably be too wide formost 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 is an integer and optional unit (example: 10M is 10*1024*1024). Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).
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 dircolorscommand to set it.
Exit status:
0if OK,
1if minor problems (e.g., cannot access subdirectory),
2if serious trouble (e.g., cannot access command-line argument).
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'ls invocation'[zy@localhost ~]$
9. 获取帮助强化
9.1 whereis
用途: 用来查找给定命令的二进制文件、源代码文件和帮助手册页的位置。
用法: whereis [command],比如 whereis ls 会显示 ls 命令的可执行文件、源代码和man手册的路径。
用法: whatis [command],例如 whatis ls 会输出 ls 命令的简短功能说明。
特点: 适合快速了解命令的基本功能,而不必阅读完整的man手册
$#2. whatis # 查看man手册相关简要说明, 以及man类型[zy@localhost Desktop]$ whatis lsls(1) - list directory contents
ls(1p) - list directory contents
[zy@localhost Desktop]$
[zy@localhost Desktop]$ man7ip
IP(7) Linux Programmer's Manual IP(7)
NAME
ip - Linux IPv4 protocol implementation
SYNOPSIS
#include <sys/socket.h>#include <netinet/in.h>#include <netinet/ip.h> /* superset of previous */
tcp_socket = socket(AF_INET, SOCK_STREAM, 0);
udp_socket = socket(AF_INET, SOCK_DGRAM, 0);
raw_socket = socket(AF_INET, SOCK_RAW, protocol);
DESCRIPTION
Linux implements the Internet Protocol, version 4, described in RFC 791 and RFC 1122.
ip contains a level 2 multicasting implementation conforming to RFC 1112. It also con‐
tains an IP router including a packet filter.
The programming interface is BSD-sockets compatible. For more information on sockets,
see socket(7).
An IP socket is created by calling the socket(2)function as socket(AF_INET,
socket_type, protocol). Valid socket types are SOCK_STREAM to open a tcp(7) socket,
Manual page ip(7) line 1(press h forhelp or q to quit)
9.3 which
用途: 查找并显示指定命令的绝对路径,即在PATH环境变量中第一个找到的可执行文件的位置。
用法: which [command],例如 which ls 会告诉你系统将执行哪个版本的 ls。