I have many gz downloaded from the internet, and I would like to make sure they are not corrupted.

Does the fact that I can open the archive with winzip on windows proves that everything is fine?

I must find a way to check their integrity without unzipping them, as they are way too big. Using Python can be an option.


  • 2
    To know if opening verifies the checksum, we'd need to know what tool you're opening with. Apr 22, 2016 at 12:56
  • winzip on windows Apr 22, 2016 at 13:20
  • also good ansver for similar question unix.stackexchange.com/a/359306/18674 Jan 8, 2021 at 23:48
  • Why is size a problem? Does it take too long? Take too much diskspace? Just too many files to do them all by hand? Dec 24, 2021 at 6:58

4 Answers 4


Using the gunzip test option

gzip -t file.tar.gz

See How to check if a Unix .tar.gz file is a valid file without uncompressing

  • thanks! is it possible to do that in python with the gzip module? Apr 22, 2016 at 13:16
  • 1
    You can use os.system("command") or subprocess.call("command")
    – shsh
    Apr 22, 2016 at 13:28

Most sites will give you a check sum of some kind to check the file is good. Most of the time it is a md5sum but there are a few out there. If you can open it that is a good sign but it doesn't always mean it is good.

  • Calculate the md5 hash of the file using md5sum filename

  • Compare the 2 provided hashes (the one you generated and the one that is provided by the website as @Mat000111 said. if they are different, then the file has been modified or it is corrupted


The gzip utility has a '-t' option which tests file integrity without bothering to unpack the file. That'll tell you if gzip thinks the file is OK.

  • great idea. how would I do that in the command line? sorry I am not very familiar with linux Apr 22, 2016 at 12:57
  • or could I do that in python? Apr 22, 2016 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.