Introduction
These file types are often used for backups or general safe-keeping of files or directories.
However, if you ever need to restore the content from these files, you should check for the integrity of these files to ensure no corruption has occurred that could prevent you from retrieving the content.
Procedure
Tarball:
tar -tf $TARBALL_FILE.tar 1>/dev/null
If you used any compression type of compression (gzip or bzip) simply specify the flag for the compression method use:
Example with gzip:
tar -tzf $TARBALL_FILE.tar 1>/dev/null
ZIP:
unzip -t $ZIP_FILE.zip
If any corruption is found it may be presented as follows. Once corruption is found on these files you will need to either obtain a copy without issues or create a new backup.
Tar:
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
ZIP:
warning [$TARBALL.zip]: 11879186 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [$TARBALL.zip]: start of central directory not found;
zipfile corrupt.
(please check that you have transferred or created the zipfile in the