Verify SHA-256 Hash During Aria2 Download on Ubuntu
This article provides a concise guide on using the aria2 download utility within the Ubuntu Linux environment to secure file transfers. It focuses specifically on the command syntax required to initiate a download while automatically validating the file’s SHA-256 checksum. By following these instructions, users can ensure data integrity immediately upon completion without needing separate verification tools.
To download a file and verify its SHA-256 hash simultaneously, you
must use the --checksum option with the aria2c
command. The basic syntax requires specifying the hash type, the actual
hash value, and the download URL.
The command structure looks like this:
aria2c --checksum=sha-256=YOUR_HASH_HERE URL
For example, if you are downloading a Linux ISO and the provider
gives you a SHA-256 hash of abc123..., you would run:
aria2c --checksum=sha-256=abc123def456... https://example.com/file.iso
When you execute this command, aria2 downloads the file and calculates its hash locally. If the calculated hash matches the one provided in the command, the download finishes successfully. If the hashes do not match, aria2 will report an error and the file integrity check will fail, indicating the file may be corrupted or tampered with.
Before running this command, ensure aria2 is installed on your Ubuntu
system. You can install it using the package manager with the command
sudo apt install aria2. Once installed, you can retrieve
the required SHA-256 hash from the official website hosting the file you
intend to download. Copy the hash string exactly and paste it into the
checksum flag to begin the secure download process.