Search results
There aren't any commands
- There aren't any commands in windows that only use dash. Even arp can use slash. Commands that can use dash are based on *nix commands e.g. arp or shutdown.
superuser.com/questions/745951/dash-or-slash-in-batch-file
Traditionally, a single dash supplies a single character option like this:-A or -V etc but need not be limited to that. e.g. -Wall for gcc turns on all compiler warnings for the gcc compiler command. double dash arguments tend to be more verbose and often take a supplied parameter like --max-count=NUM. However, --version takes no equals.
Aug 21, 2019 · But have you ever wondered when to use one or the other: a single dash or a double dash? $ ls --size -l $ ls -ls. It’s actually pretty simple. A single dash can be followed by any number of single-character flags, while a double dash can be followed only by a single, multi-character option.
Dec 13, 2023 · It all depends on the program. Usually "-" is used for 'short' options (one-letter, -h), and "--" is used for "long" (er) options (--help). Short options can usually be combined (so "-h -a" is same as "-ha") In Unix-like systems, the ASCII hyphen–minus is commonly used to specify options.
- Overview
- The Meaning of “-” Character
- Using “-” to Specify A Standard Input
- Using “-” to Specify A Standard Output
- Using “-” For Git Branches
- Using “-” with The CD Command
- Where Else Can We Use “-“?
- Conclusion
In this tutorial, we’ll see what the “-” character is about and what purpose it serves. We’ll take a look at the most common use-cases where the use of “-” makes more sense than alternative approaches.
The “-” character means different things to different commands on the Linux terminal. There is no universal convention for using the “-” character with the Linux commands. However, on the most commonly used shells like bash and zsh, the “-” character is used to specify a standard input or a standard output for a command. It’s a command-specific con...
Most of the commands on Linux treat the string “-” as a synonym for stdin or stdout. So, for instance, when we use the cat command with a naked “-“, it will read from stdin: The “-” in the above command is actually an alias for /dev/stdin.Therefore, we can also replace the “-” with /dev/stdin,and nothing will change: So, it begs the question, what ...
In the same way, we can also use “-” to specify a standard output for a specific command. In our curl example, we used “-” to print the binary output of the remote file to our standard output: As we can see, we explicitly told the curl command to output the contents of the binary file because, by default, curl will not print binary contents to stdo...
As we know, the “-” means different things to different commands. In the case of git, we can use it as an argument to the git checkout command to check out the previous active branch or detached HEAD.For instance, if we have a Git repository and two branches on the repository, we can switch between those two branches by using “-“:
Similarly, as with the git command, we can also use “-” as an argument to the cd command to switch between the current and the previous directory. Let’s see it in action: Our shell stores the old path in an environment variable known as $OLDPWD. Therefore, the “-” parameter acts as an alias for $OLDPWD:
As we saw, it’s up to each tool or command to interpret the “-” parameter. However, many other tools use the “-” parameter for different purposes. The most common and reliable way to find out whether a tool has support for the “-” parameter is to go through its official manpages.
In this article, we looked at the meaning of using “-” in the Linux command-line and how it is interpreted by the most common commands. We also saw a few use cases where we can use “-” to read from stdin and write to stdout. Finally, we saw how to use “-” with git and cdcommands.
Jun 7, 2023 · Single Dash vs Double Dashes in Shell Commands. When you’re using a shell command, it’s common to pass options to that command using dashes—which are also called hyphens. These options can be specified with either a single dash (-) or a double dash (—).
There is nothing magic about the -character as far as the shell is concerned (except that the shell itself, and some of its built-in commands like cd and echo, use it in conventional ways). Some characters, like \ , ' , and " , are "magical", having special meanings wherever they appear.
People also ask
When to use a single dash or a Double Dash?
When should you use a hyphen in a shell command?
Should a program have a dash?
Why do we use a double dash for long options?
Why are there two types of shorthand command combining?
Does CD interpret a dash?
More precisely, a double dash (--) is used in most Bash built-in commands and many other commands to signify the end of command options, after which only positional ("non-option") arguments are accepted. Example use: Let's say you want to grep a file for the string -v.