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
上一篇:汇编(五)栈、CPU提供的栈机制、push、pop指令


下一篇:从U盘安装RedHat Linux的具体步骤