How do I verify that a file transferred correctly?
Calculate SHA256 for the source and destination and compare the complete values. A matching digest gives strong evidence that the bytes are the same. It does not by itself establish who created the file or whether its contents are safe.
Instructions
1. Hash the local Windows file
Use a literal path to avoid wildcard expansion and name the algorithm explicitly.
Get-FileHash -LiteralPath ".\package.dat" -Algorithm SHA256Read the Hash value. Windows often displays hexadecimal letters in uppercase.
2. Hash the corresponding Linux file
Run this after the transfer finishes, using the actual remote destination path.
sha256sum "$HOME/package.dat"GNU sha256sum prints the digest and filename. Hexadecimal letter case does not change the value.
3. Compare the same stable content
Compare the full digest, not just a prefix. Make sure neither file is being changed while you measure it. When checking a downloaded software package, obtain the expected checksum or signature through the publisher’s trusted channel, not only from the same untrusted download source.
Check the result
- Both digests use SHA256 and match across all characters.
- The measured files are the intended source and destination, with transfer complete.
Troubleshooting
- The digests differ
- Check for the wrong file, a partial transfer, a changed source or line-ending conversion.
- The filenames differ but hashes match
- Renaming does not change content; assess whether that was the intended destination name.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
