I have compressed a folder using following command:

tar czvf arch.tar.gz dirname/

When I try to uncompress it using following command

tar xvfz arch.tar.gz

then it uncompress folder but contents of folder remains compressed.

Before compression there were files in folder like index.php. Now after uncompressing there is a file index.php.gz

Please advice me where I am wrong.

link|improve this question
feedback

3 Answers

If you've got compressed files in your output from tar, it's because they were compressed going in. You can verify with with tar tzvf arch.tar.gz.

link|improve this answer
feedback

Hm, in my Ubuntu this commands run correct.

strangeman@etalon:~$ tar czvf test.tar.gz test/
test/
test/file1
test/file2
test/file3
test/file4
test/file5
test/file6
test/file7
test/file8
test/file9
test/file0
strangeman@etalon:~$  tar xvfz test.tar.gz
test/
test/file1
test/file2
test/file3
test/file4
test/file5
test/file6
test/file7
test/file8
test/file9
test/file0
link|improve this answer
feedback

I think your problem lies with the order you used for the tar switches. You ran:

tar xvfz arch.tar.gz

A correct ordering would leave the f switch last:

tar zxvf arch.tar.gz

This way, arch.tar.gz is an argument to f. I don't think you can put any other switch after f and get any predictable behavior across different tar implementations.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.