![Forrest logo](/images/logo.png)
shasum:tldr:b507d
The command shasum --check ${filename}
is used to verify the integrity of a file by comparing its checksum value with the expected value. Here's how it works:
- The command starts with
shasum
, which is a command-line utility for generating or checking SHA checksums. - The
--check
option specifies that the command will be used to verify checksums. ${filename}
is a placeholder for the actual name of the file you want to verify. You need to replace${filename}
with the actual file name or path. For example, if you want to verify the checksum of a file namedexample.txt
, the command would look like:shasum --check example.txt
.
When you run this command, it reads the file specified by ${filename}
and calculates the SHA checksum value. It then looks for a corresponding checksum value in a file with the same name and a .shasum
extension (e.g., example.txt.shasum
). Typically, this file is created separately and contains the expected checksum value.
If the calculated checksum matches the expected value, the command will display the filename and a message indicating that the checksum is correct. Otherwise, it will display an error message indicating that the checksum does not match, meaning the file may have been modified or corrupted.