每天一个Linux命令(6)cksum


cksum check sum
cksum命令是检查文件的CRC是否正确,确保文件从一个系统传输到另一个系统的过程中不被损坏。这种方法要求校验和在源系统中被计算出来,在目的系统中又被计算一次,两个数字进行比较,如果校验和相等,则该文件被认为是正确传输了。
注意:CRC是指一种排错检查方法,即循环冗余校验法。

指定文件交由cksum命令进行校验后,会返回校验结果供用户核对文件是否正确无误。若不指定任何文件名称或是所给予的文件名为"-",则cksum命令会从标准输入设备中读取数据。

使用cksum命令计算文件"testfile1"的完整性,输入如下命令:

cksum testfile1 #对指定文件进行CRC校验
以上命令执行后,将输出校验码等相关的信息,具体输出信息如下所示:

1263453430 78 testfile1 #输出信息
上面的输出信息中,"1263453430"表示校验码,"78"表示字节数。

注意:如果文件中有任何字符被修改,都将改变计算后CRC校验码的值。

NAME

   cksum - checksum and count the bytes in a file

SYNOPSIS

   cksum [FILE]...
   cksum [OPTION]

DESCRIPTION

   Print CRC checksum and byte counts of each FILE.

   --help display this help and exit

   --version
          output version information and exit

   GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report cksum translation bugs to <http://translationproject.org/team/>

AUTHOR

   Written by Q. Frank Xia.

COPYRIGHT

   Copyright © 2013 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
   This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO

   The full documentation for cksum is maintained as a Texinfo manual.  If the info and cksum programs are properly installed at your site, the command

          info coreutils 'cksum invocation'

   should give you access to the complete manual.

本文链接:

https://heyzen.club/index.php/Coder/79.html
1 + 4 =
快来做第一个评论的人吧~