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?

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

3 Answers

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
link|improve this answer
Not sure how, but it looks like that is exactly what I did. Thanks for the quick response. – inksquared 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
feedback

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/
link|improve this answer
Will definitely use this single step in the future. Appreciate it. – inksquared Apr 13 '11 at 13:02
feedback

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.

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.