# cksum

检查文件的CRC是否正确

## 补充说明

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

注意：CRC是指一种排错检查方法，即循环冗余校验法。

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

### 语法

```
cksum(选项)(参数)
```

### 选项

```
--help：在线帮助；
--version：显示版本信息。
```

### 参数

文件：指定要计算校验的版本信息。

### 实例

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

```
cksum testfile1            #对指定文件进行CRC校验
```

以上命令执行后，将输出校验码等相关的信息，具体输出信息如下所示：

```
1263453430 78 testfile1     #输出信息
```

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hezhiqiang.gitbook.io/linux/ming-ling/cksum.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
