Given the following command:
gzip -dc /cdrom/cdrom0/file.tar.gz | tar xvf –
What does the
- at the end of the command mean? Is it some kind of placeholder?
In this case, it means ‘standard input’. It's used by some software (e.g.
In this instance, standard input is the argument to the
Don't rely on this to mean ‘standard input’ universally. Since it's not interpreted by the shell, every program is free to deal with it as it pleases. In some cases, it's standard output or something entirely different: on
|show 1 more comment|
In this case, the
GNU tar (the version on Linux) accepts its input from the standard input by default. If you do not want this behaviour, and want to pass the file name as a command line argument, then you need to specify the flag
So this is the same as
Or, if the input is gzipped as in your example:
It isn’t meaningful to specify the
Furthermore, the above line can be simplified because GNU tar can be told to stream the input through
– No need to call
|show 4 more comments|