Like most Unix commands, `-` as an input filename means to read standard input.
– BarmarFeb 11 '22 at 02:47
1
There's no need for it here, since `cat` reads standard input by default if there are no filename arguments.
– BarmarFeb 11 '22 at 02:48
It's useful if you want to mix standard input with other files, e.g. `cat file1 - file2` will put standard input between the two files.
– BarmarFeb 11 '22 at 02:48
There must be previous questions like this, but I can't figure out a search term to find it. Hopefully someone else can, so this can be closed as a duplicate.
– BarmarFeb 11 '22 at 02:52
1
@Barmar "what does hyphen mean in unix?" -> https://stackoverflow.com/questions/8045479/whats-the-magic-of-a-dash-in-command-line-parameters Clear duplicate.
– danFeb 11 '22 at 04:10
1
@ahdr you can learn a lot by typing man commandname. For example, typing man cat gave me this information "If file is a single dash (`-') or absent, cat reads from the standard input."
– SydOwlFeb 11 '22 at 06:18