How to Check CRC Checksum of Files in Zip Archive on Ubuntu
This guide explains how to verify the integrity of files within a zip archive on Ubuntu using CRC checksums. You will learn the specific commands required to test archives without extracting them, ensuring your data remains uncorrupted during transfer or storage. We will focus on built-in tools available in the standard Linux environment.
Prerequisites
You need the unzip utility installed on your Ubuntu
system. It is typically installed by default. If it is missing, install
it using the following command:
sudo apt update
sudo apt install unzipTesting the Archive Integrity
To check the CRC checksum of files inside a zip archive, use the
-t flag with the unzip command. This command
tests the integrity of the specified zip file without extracting its
contents to the disk.
Run the following command in your terminal:
unzip -t archive.zipReplace archive.zip with the actual name of your
file.
Understanding the Output
The terminal will display a list of files contained within the archive. Next to each filename, you will see a status message.
- OK: The CRC checksum matches, and the file is intact.
- bad CRC: The calculated checksum does not match the stored value, indicating data corruption.
At the end of the process, unzip will provide a summary
stating whether the test was successful or if errors were found.
Verifying Specific Files
If you only want to check the CRC checksum for specific files within the archive, you can specify their names after the archive name.
unzip -t archive.zip file1.txt file2.jpgThis method allows for quick verification of critical data without processing the entire archive.
Using 7z for Detailed Verification
If you require more detailed output or are handling complex archives,
you can use the 7z tool. Install it via
sudo apt install p7zip-full. To test the archive, run:
7z t archive.zipThis command performs a similar integrity check and reports the CRC status for every file included in the zip archive.