sha256sum
檔案與目錄
用法
sha256sum [file]印出檔案的 SHA-256 指紋,用來核對下載是否完整;雜湊相同只說明位元組一致,並不說明來源可信。
常用選項
| 選項 | 含義 |
|---|---|
| -c | Read a list of hashes and check each file against it |
| -b | Binary mode, which matters on Windows-style line endings |
| --tag | GNU: print in the BSD format, SHA256 (file) = hash |
| --ignore-missing | GNU: with -c, skip files that are not there |
| shasum -a 256 | The same digest where sha256sum is missing, as on older macOS |
範例
sha256sum ubuntu.isoPrints the hash to compare with the download page.
sha256sum -c SHA256SUMSVerifies every file named in the checksum list.
shasum -a 256 ubuntu.isoThe portable macOS spelling.
搬移、刪除和尋找。有些命令不會再問一次,所以順手加 -i 是在救自己。
怎麼看
- 方括號 [ ] 表示這部分可以不寫。
- 省略號 … 表示可以寫多個。
- 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。
常見問題
Q. sha256sum 是做什麼的?
印出檔案的 SHA-256 指紋,用來核對下載是否完整;雜湊相同只說明位元組一致,並不說明來源可信。
Q. 怎麼寫?
sha256sum [file] —— 方括號表示可以省略的部分。
Q. 值得記的選項有幾個?
這裡列了 5 個,完整列表在 man sha256sum。這條命令屬於檔案與目錄。
相關命令
man 手冊: man sha256sum