0
点赞
收藏
分享

微信扫一扫

linux如何查看命令的用法

彭维盛 2022-08-01 阅读 84
linuxmain

help command   #适用于内部命令

[root@zhang-baidunode2 ~]# 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.

The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
with a slash (/), then CDPATH is not used.

If the directory is not found, and the shell option `cdable_vars' is set,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.

Options:
-L force symbolic links to be followed: resolve symbolic
links in DIR after processing instances of `..'
-P use the physical directory structure without following
symbolic links: resolve symbolic links in DIR before
processing instances of `..'
-e if the -P option is supplied, and the current working
directory cannot be determined successfully, exit with
a non-zero status
-@ on systems that support it, present a file with extended
attributes as a directory containing the file attributes

The default is to follow symbolic links, as if `-L' were specified.
`..' is processed by removing the immediately previous pathname component
back to a slash or the beginning of DIR.

Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.

command -h/--help   #适用于外部命令

[root@zhang-baidunode2 ~]# curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
--cert-status Verify the status of the server certificate
--cert-type <type> Certificate file type (DER/PEM/ENG)
--ciphers <list of ciphers> SSL ciphers to use
--compressed Request compressed response
--compressed-ssh Enable SSH compression
-K, --config <file> Read config from a file
--connect-timeout <seconds> Maximum time allowed for connection
--connect-to <HOST1:PORT1:HOST2:PORT2> Connect to host
-C, --continue-at <offset> Resumed transfer offset
-b, --cookie <data> Send cookies from string/file
-c, --cookie-jar <filename> Write cookies to <filename> after operation
--create-dirs Create necessary local directory hierarchy
--crlf Convert LF to CRLF in upload
--crlfile <file> Get a CRL list in PEM format from the given file

man command

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
is specified.

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 C-style escapes for nongraphic characters

--block-size=SIZE
with -l, scale sizes by SIZE when printing them; e.g., '--block-size=M'; 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, newest first

官网链接地址:​​https://www.kernel.org/doc/man-pages/​​

数字

说明

1

可执行程序或 Shell 命令

2

系统调用(内核提供的函数)

3

库调用,open,write

4

特殊文件(通常位于 /dev 目录)

5

文件格式和约定(比如 /etc/passwd)

6

游戏

7

杂项(包和一些约定)Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)

8

系统管理命令(通常是 root 用户执行的命令)

9

内核相关的文件 Kernel routines [Non standard]

[]:可选内容;<>:必须给出内容;a|b|c:多选一;...:可以有多个

节名称

解释

NAME

命令名称和命令简短的介绍

SYNOPSIS

语法,使用的方法,比如需要 #include <unistd.h> 或命令参数 objdump [-d]

CONFIGURATION

配置信息

DESCRIPTION

命令的描述

OPTIONS

命令的选项,比如 ls -l 中的 -l 就是选项

EXIT STATUS

命令的退出状态

RETURN VALUE

命令返回值

ERRORS

命令的错误信息

ENVIRONMENT

命令使用的环境变量

FILES

命令用到的文件

VERSIONS

命令的版本

CONFORMING TO


命令遵循的标准,比如 POSIX 标准,可以参考 man _exit

NOTES

其他可以参考的资料,可以参考 man _exit

BUGS

提交 BUG 的方式,man ls 中为 REPORTING BUGS

EXAMPLE

示例用法

AUTHORS

命令的作者

SEE ALSO

类似于友情链接,显示一些相关的命令

info command

举报

相关推荐

0 条评论