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 recently begun using a VPS and am learning linux along the way. I have compressed a folder using tar, then I gzipped it and used scp to send it to my server. When I decompress using tar -zxvf .tar.gz, all of the files within the folder still have .gz . Am I compressing the folder wrong to begin with?

share|improve this question
    
This should probably have been asked on superuser.com or unix.stackexchange.com. –  Caleb Apr 13 '11 at 12:39

3 Answers 3

Is it possible that you first gzipped the files inside the folder, then used tar and then again gzipped the tar file? Something like this:

gzip folder/*
tar -cvf folder.tar folder
gzip folder.tar

If yes - the first gzip was too much. You should simply do:

tar -cvf folder.tar folder
gzip folder.tar

Or even simpler

tar -cvzf folder.tar.gz folder
share|improve this answer
    
Not sure how, but it looks like that is exactly what I did. Thanks for the quick response. –  mikeyrocks Apr 13 '11 at 13:02
    
...and the command to extract this file is tar xvzf folder.tar.gz. v = verbose (print the names of the files as they are extracted), z = gzip file and f folder.tar.gz specifies the file. See the manual page on tar. –  Lekensteyn Apr 13 '11 at 13:14

Yes, you are compressing the folder wrong to begin with. You can do it correctly all in one step like this:

tar cvfz tarfile.tar.gz folder/
share|improve this answer
    
Will definitely use this single step in the future. Appreciate it. –  mikeyrocks Apr 13 '11 at 13:02

Try a "tar -tvzf" on your archive and check if the files inside the archive are individually gzipped from their file names. It's the only way I can think of that might make this happen, although I'm not sure how you would have gzipped each file while compressing.

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.