2014-07-22 17:56:22 +08:00
|
|
|
# sha256sum
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Calculate SHA256 cryptographic checksums.
|
2021-04-02 21:05:11 +02:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html>.
|
2014-07-22 17:56:22 +08:00
|
|
|
|
2023-05-19 11:34:36 +02:00
|
|
|
- Calculate the SHA256 checksum for one or more files:
|
2014-07-22 17:56:22 +08:00
|
|
|
|
2023-05-19 11:34:36 +02:00
|
|
|
`sha256sum {{path/to/file1 path/to/file2 ...}}`
|
2016-01-20 03:45:42 -08:00
|
|
|
|
2023-05-19 11:34:36 +02:00
|
|
|
- Calculate and save the list of SHA256 checksums to a file:
|
2016-01-20 03:45:42 -08:00
|
|
|
|
2023-05-19 11:34:36 +02:00
|
|
|
`sha256sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha256}}`
|
2014-07-22 17:56:22 +08:00
|
|
|
|
2023-05-19 11:34:36 +02:00
|
|
|
- Calculate a SHA256 checksum from `stdin`:
|
2020-12-18 15:14:04 +01:00
|
|
|
|
2023-05-20 04:11:11 +02:00
|
|
|
`{{command}} | sha256sum`
|
2020-12-18 15:14:04 +01:00
|
|
|
|
2024-11-20 13:31:57 +01:00
|
|
|
- Read a file of SHA256 checksums and filenames and verify all files have matching checksums:
|
2014-07-22 17:56:22 +08:00
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sha256sum {{[-c|--check]}} {{path/to/file.sha256}}`
|
2020-12-18 13:31:59 +01:00
|
|
|
|
2022-03-28 16:21:41 +02:00
|
|
|
- Only show a message for missing files or when verification fails:
|
2020-12-18 13:31:59 +01:00
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sha256sum {{[-c|--check]}} --quiet {{path/to/file.sha256}}`
|
2022-03-28 16:21:41 +02:00
|
|
|
|
2023-05-19 11:34:36 +02:00
|
|
|
- Only show a message when verification fails, ignoring missing files:
|
2022-03-28 16:21:41 +02:00
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`sha256sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.sha256}}`
|
2024-11-18 16:51:29 +07:00
|
|
|
|
2024-11-23 22:45:05 +01:00
|
|
|
- Check a known SHA256 checksum of a file:
|
2024-11-18 16:51:29 +07:00
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`echo {{known_sha256_checksum_of_the_file}} {{path/to/file}} | sha256sum {{[-c|--check]}}`
|