check sha256sum value consistent with the reference value

how to check sha256sum value consistent with the reference value of the files downloaded( or copied) from somewhere ?
1. usage of the command sha256sum
Usage: sha256sum [OPTION]... [FILE]...
Print or check SHA256 (256-bit) checksums.
With no FILE, or when FILE is -, read standard input.

  -b, --binary         read in binary mode
  -c, --check          read SHA256 sums from the FILEs and check them
      --tag            create a BSD-style checksum
  -t, --text           read in text mode (default)
  Note: There is no difference between binary and text mode option on GNU system.

The following four options are useful only when verifying checksums:
      --quiet          don't print OK for each successfully verified file
      --status         don't output anything, status code shows success
      --strict         exit non-zero for improperly formatted checksum lines
  -w, --warn           warn about improperly formatted checksum lines

      --help     display this help and exit
      --version  output version information and exit

The sums are computed as described in FIPS-180-2.  When checking, the input
should be a former output of this program.  The default mode is to print
a line with checksum, a character indicating input mode ('*' for binary,
space for text), and name for each FILE.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'sha256sum invocation'
2. An Example
[biocodee@localhost Downloads]$ ls -al
total 136640
drwxr-xr-x.  2 biocodee biocodee       231 Dec 25 09:44 .
drwx------. 16 biocodee biocodee      4096 Dec 25 07:53 ..
-rw-r--r--.  1 biocodee biocodee     40212 Dec 20 11:16 container-selinux-2.107-3.el7.noarch.rpm
-rw-r--r--.  1 biocodee biocodee  36243572 Dec 20 10:55 docker-ce-18.03.0.ce-1.el7.centos.x86_64.rpm
-rw-rw-r--.  1 biocodee biocodee 103553755 Dec 25 07:12 Miniconda3-py38_4.10.3-Linux-x86_64.sh
-rw-rw-r--.  1 biocodee biocodee        65 Dec 25 07:53 Miniconda3-py38_4.10.3.sha256
-rw-r--r--.  1 biocodee biocodee     69596 Dec 20 11:23 pigz-2.3.3-1.el7.centos.x86_64.rpm
[biocodee@localhost Downloads]$ echo "$(cat Miniconda3-py38_4.10.3.sha256) Miniconda3-py38_4.10.3-Linux-x86_64.sh" | sha256sum --check 
Miniconda3-py38_4.10.3-Linux-x86_64.sh: OK
[biocodee@localhost Downloads]$ echo "$(cat Miniconda3-py38_4.10.3.sha256) container-selinux-2.107-3.el7.noarch.rpm" | sha256sum --check 
container-selinux-2.107-3.el7.noarch.rpm: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
[biocodee@localhost Downloads]$ cat Miniconda3-py38_4.10.3.sha256 
935d72deb16e42739d69644977290395561b7a6db059b316958d97939e9bdf3d
[biocodee@localhost Downloads]$ echo "935d72deb16e42739d69644977290395561b7a6db059b316958d97939e9bdf3d Miniconda3-py38_4.10.3-Linux-x86_64.sh" | sha256sum --check 
Miniconda3-py38_4.10.3-Linux-x86_64.sh: OK
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值