how to verify whether a compressed .gz is corrupted or not?

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

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