Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer

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
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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