linux命令啥时候加与不加横杠?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux命令啥时候加与不加横杠?相关的知识,希望对你有一定的参考价值。

比如 tar xvfz filename.tar.gz
就不加横杠 -
但是其他的
又要加 比如 find / -name "filename"
name前加了-

命令有参数的时候空一格加一个 “-”
例如: ll -Z
shell写判断的时候的判断参数需要有“-”
例如:if [ -d /var ]; then echo "/var is a directory"; else echo "/var is not exists"; fi;
参考技术A 以 man ps 为例
This version of ps accepts several kinds of options:

1 UNIX options, which may be grouped and must be preceded by a dash.
2 BSD options, which may be grouped and must not be used with a dash.
3 GNU long options, which are preceded by two dashes.

以man tar为例
The first argument to tar should be a function; either one of the letters
Acdrtux, or one of the long function names. A function letter need not
be prefixed with ``-'', and may be combined with other single-letter
options. A long function name must be prefixed with --. Some options
take a parameter; with the single-letter form these must be given as sep‐
arate arguments. With the long form, they may be given by appending
=value to the option.
参考技术B 固定格式锅。 参考技术C -name 是固定写法。-time,-size 什么的。必须写的这是。本回答被提问者采纳

以上是关于linux命令啥时候加与不加横杠?的主要内容,如果未能解决你的问题,请参考以下文章

@RequestParam详解以及加与不加的区别

@RequestParam注解加与不加的区别

linux命令结尾加斜杠与不加斜杠的区别

nginx配置proxy_pass URL末尾加与不加/(斜线)的区别

nginx 配置proxy_pass URL末尾加与不加/(斜线)的区别

linux中,命令后加&与不加&的本质区别是啥? 我知道加&表示是后台运行?