16

How can I check whether a zip file is damaged? I know that with zip -F input.zip --out output.zip I can fix the file. But I could not find an option that only checks the file CRC.

I'm using Ubuntu 12.04.

3
  • 1
    Thanks! So with unzip -t I can check if the zip file is damaged. Should I do something if similar question is already exist?
    – ironsand
    Commented Jul 16, 2013 at 9:42
  • I don't think you have sufficient rep yet, but if you want we can mark as duplicate for you.
    – Karan
    Commented Jul 16, 2013 at 15:12
  • The post you wrote give me enough information for me. Please mark this post as duplicate.
    – ironsand
    Commented Jul 16, 2013 at 16:18

2 Answers 2

24

I would use the -T / --test flag to check integrity.

2
  • I want only check file integrity without making zip file. thanks anyway!
    – ironsand
    Commented Jul 16, 2013 at 9:37
  • 4
    which is what -T does: zip -T existing.zip
    – akira
    Commented Jul 16, 2013 at 9:57
1

You could md5sum command to check for the file integrity. This will generate a 128 bit hash string. You can generate the simultaneous hash string for the original zip file and compare both of them. You just have to run the following command to generate md5 checksum,

:~$ md5sum <filename>
<128 bit hash string> <filename>

If the string matches then the file is not damaged. It is a good and easy way to check file integrity.

1
  • As a precaution it's a good way. I'll use the command next time. Thanks!
    – ironsand
    Commented Jul 16, 2013 at 9:44

Not the answer you're looking for? Browse other questions tagged .