Showing posts from February, 2014

invalid compressed data--format violated on Linux

I created a zip file on Linux environment. I wanted to transfer this zip file to another linux machine. For this, I uploaded the zip file to server using ftp. Now, after downloading the zip file on other server I tried to unzip it on other linux machine. Their I get following error -

gzip: <file name> : invalid compressed data--format violated

After some analysis and googling I found that reason for this error was the way I was uploading and downloading files from ftp server. When I used binary format to upload and download the zip file I was able to unzip it on other linux machine without any error.

Here are the commands that I used on linux file to zip and upload file -
$ gzip file.txt             (This will create file.txt.gz file)

$ ftp <URL of ftp server>

$ ftp : <enter username and password to login>

$ ftp binary

$ ftp put file.txt.gz

Above commands will zip file.txt and upload that on server in binary format

On other linux machine I used following commands to downloa…