0

I have just uploaded tar.gz archive to my Centos server from my home Windows 7 computer. Before that, it was extracted from .zip archive.

When I try to extract it:

tar -xvf file.tar.gz
gunzip file.tar.gz

It always give me error: "not in gzip format"

The archive is not corrupted, because it is possible to extract it in Windows with Winrar.

The archive is quite big, more than 100 MB.

I don't know, what's the problem. Could you help me please? Thanks.

Peter

Petuga
  • 1
  • 1
  • 2
  • Have you tried not including the "-" in front of xvf? – Univ426 Oct 11 '12 at 15:02
  • 4
    Firstly, can we find out what the file really is; can you do a `file file.tar.gz` and post the results in your question? – MadHatter Oct 11 '12 at 15:03
  • The file command returns "data" as the file type. – Petuga Oct 11 '12 at 15:06
  • 1
    Then you might think it's not corrupt, but CentOS disagrees. A proper gzipped file should return "gzip compressed data...", an uncompressed tarfile "POSIX tar archive...". How did you transfer the file from the Win7 box? – MadHatter Oct 11 '12 at 15:08
  • I have uploaded it via ssh tunnel (Tunnelier). – Petuga Oct 11 '12 at 15:09
  • I don't know that, so can't comment on it. You might try moving the original zip file across, and try `unzip -t foo.zip` on it, to see if extracting the contained tgz file on linux will work any better. – MadHatter Oct 11 '12 at 15:11
  • try: tar -zxvf file.tar.gz – Hex Oct 11 '12 at 15:17
  • You don't need to repackage a .zip file into .tar.gz before uploading it to your server. You can `unzip` the zip file directly.... `yum install unzip` – Michael Hampton Oct 11 '12 at 15:23
  • I am uploading the whole .zip archive now. I will try to extract it. – Petuga Oct 11 '12 at 15:24

2 Answers2

2

Are you sure you transferred the file from Windows to Linux in BINARY mode (if using FTP)?

Otherwise:

If under linux system to extract files from the archive, use this:

tar -zxvf archive.tar.gz

This will both UNgzip and UNtar the files and directories.

mdpc
  • 11,856
  • 28
  • 53
  • 67
1

Don't really understand this string: "tar -xvf file.tar.gz gunzip file.tar.gz"

tar xvf file.tar.gz

is enought to extract gzipped tar archive. Are you sure it is gzipped? Check with following:

file file.tar.gz
GioMac
  • 4,544
  • 4
  • 27
  • 41