I was able to archive and compress a folder with the following command:
tar -cvfz example2.tgz example1
I then removed the example1 folder and tried to unpack the archive using this command:
tar -xvfz example2.tgz
and tried
tar -zxvf example2.tgz
Niether of these commands worked. The error returned was:
gzip: example2.tgz: not in gzip format
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
It clearly used gzip compression since I passed tar the z
qualifier in the initial command. What am I doing wrong? I am on Ubuntu 14.0.4
Best Answer
The command you're showing in your first line (
tar -cvfz example2.tgz example1
) doesn't work and it should not output any fileexample2.tgz
. Didn't you get an error? Perhaps the fileexample2.tgz
existed already? Check if you have a file calledz
in that folder - that's where the tgz has been saved to, because:The
-f
parameter specifies the file which must follow immediately afterwards:-f <file>
Try