Skip to main content

You have misunderstood an earlier answer. The problem is not the "-"-, it is where the "f"f is in your argument list.

tar cvfz target.tgz

tar cvfz target.tgz <files>

Will try to create an archive called "z", as that is the text after "f"f. The error message is because tar can't find "target.gz" to add to archive "z".

tar cvzf target.tgz

tar cvzf target.tgz <files>

Will correctly create target.tgz and add files to it. This is because target.tgz is the first text after the ff argument.

You have misunderstood an earlier answer. The problem is not the "-", it is where the "f" is in your argument list.

tar cvfz target.tgz

Will try to create an archive called "z", as that is the text after "f". The error message is because tar can't find "target.gz" to add to archive "z".

tar cvzf target.tgz

Will correctly create target.tgz and add files to it. This is because target.tgz is the first text after the f argument.

You have misunderstood an earlier answer. The problem is not the -, it is where the f is in your argument list.

tar cvfz target.tgz <files>

Will try to create an archive called "z", as that is the text after f. The error message is because tar can't find "target.gz" to add to archive "z".

tar cvzf target.tgz <files>

Will correctly create target.tgz and add files to it. This is because target.tgz is the first text after the f argument.

Source Link

You have misunderstood an earlier answer. The problem is not the "-", it is where the "f" is in your argument list.

tar cvfz target.tgz

Will try to create an archive called "z", as that is the text after "f". The error message is because tar can't find "target.gz" to add to archive "z".

tar cvzf target.tgz

Will correctly create target.tgz and add files to it. This is because target.tgz is the first text after the f argument.