To verify file integrity, you can use checksums or hash functions. Here’s a simple way to do it using md5sum or sha256sum in a Unix-like environment:
-
Generate a checksum for the original file:
md5sum filename.txt > filename.txt.md5or for SHA256:
sha256sum filename.txt > filename.txt.sha256 -
Verify the file later:
To check the integrity, you can use:md5sum -c filename.txt.md5or for SHA256:
sha256sum -c filename.txt.sha256
If the output indicates that the file is OK, then the integrity is verified. If not, the file may have been altered or corrupted.
