man页中,我遇到了编写Linux/Unix命令的各种语法,包括方括号、尖括号、连字符(-)和双连字符(--)的各种组合.有人知道这些语法约定的含义吗?

[ ]
< >
[< >]
[--]
-
--
[< >...]

推荐答案

Square Brackets [ ]

方括号([])表示封闭的元素(参数、值或信息)是可选的.您可以 Select 一个或多个项目,也可以不 Select 任何项目.不要在命令行中键入方括号.

示例:[global options], [source arguments], [destination arguments]

Angle Brackets < >

The angle brackets ( < > ) indicate that the enclosed element (parameter, value, or information) is mandatory. You are required to replace the text within the angle brackets with the appropriate information. Do not type the angle brackets themselves in the command line.

示例:-f [set the File Name variable], -printer <printer name>, -repeat <months> <days> <hours> <minutes>, date access <mm/dd/yyyy>

在类Unix系统中,ASCII连字符–减号通常用于指定选项.字符后面通常有一个或多个字母.参数本身是一个连字符-负号,没有任何字母,通常指定程序应该处理来自标准输入的数据或将数据发送到标准输出.有些程序使用两个连字符(-)来指定"长选项",其中使用了更具描述性的选项名称.这是GNU软件的一个常见功能.

只要做"ls--help",看看选项,你就会明白这一点.

 -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
 -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] 

Linux相关问答推荐

Linux内核中维护进程无关寄存器失败

无法在Raspberry PI 3 Model B上分配256TB的虚拟内存

在linux中,我想将昨天的文件与今天的文件进行比较,仅将今天的更改作为输出,忽略一些字段

2023 年如何在现代 Linux 上安装 Firebird SQL 版本 3 或 4?

如何在Linux中将文件的特定行号中的数字乘以2(双)?

当接收端未从套接字读取时,通过 Unix 套接字发送的消息会发生什么情况?

在三星 chromebook 上编程

在不调试的情况下查找哪个汇编指令导致了非法指令错误

从 Linux shell 将多个文件从一个目录复制到另一个目录

通过 Linux FrameBuffer 将像素绘制到屏幕上

size_t 和 off_t 的用法有什么区别?

docker images显示图像,docker rmi表示没有这样的图像或参考不存在

并行运行 shell 脚本

错误:ld.so:无法预加载对象 LD_PRELOAD:忽略

使用 C++ 和 Linux 的高分辨率计时器?

cmake : 从脚本设置环境变量

在 Ubuntu 中学习 OpenGL

如何在 Linux 中查看日志(log)文件并在查看时应用自定义过滤器?

如何在 linux 或 unix 上找到用户的主目录?

System.currentTimeMillis 是否总是返回一个值 >= 以前的调用?