tar command: what is dash for? [closed] tar command: what is dash for? [closed] shell shell

tar command: what is dash for? [closed]


The very first dash is unnecessary, you could equally write:

tar cvf ...

The second dash belongs with the f option and it says "instead of creating a named file in the filesystem, write the tarred up files onto stdout".

That stdout is then passed through the pipe into ssh. The corresponding untar on the remote machine is untarring from its stdin in exactly the same way.

So, in answer to your question, the dashes mean stdout when creating/writing a tarfile with tar cf and stdin when extracting/reading a tarfile with tar xf