Forrest logo
back to the shasum tool

shasum:tldr:b507d

shasum: Read a file of SHA1 sums and filenames and verify all files have matching checksums.
$ shasum --check ${filename}
try on your machine

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:

  1. The command starts with shasum, which is a command-line utility for generating or checking SHA checksums.
  2. The --check option specifies that the command will be used to verify checksums.
  3. ${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 named example.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.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the shasum tool