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?
Asked
Active
Viewed 467 times
0
-
This should probably have been asked on http://superuser.com or http://unix.stackexchange.com. – Caleb Apr 13 '11 at 12:39
3 Answers
2
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.

Christi
- 200
- 1
- 10
2
Is it possible that you first gzip
ped the files inside the folder, then used tar
and then again gzip
ped 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

bmk
- 2,339
- 2
- 15
- 10
-
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](http://unixhelp.ed.ac.uk/CGI/man-cgi?tar). – Lekensteyn Apr 13 '11 at 13:14
1
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/

Caleb
- 11,813
- 4
- 36
- 49