← 返回命令列表

Linux command

sum 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Calculate checksum

sum [file]

Use System V algorithm

sum -s [file]

Explicitly use BSD algorithm

sum -r [file]

Read from stdin

cat [file] | sum

说明

sum prints checksum and block counts for each FILE. With no FILE, or when FILE is -, reads standard input. The default BSD algorithm uses 1024-byte blocks, while the System V algorithm uses 512-byte blocks. This is a legacy utility provided for compatibility. The cksum command is preferred for new applications.

参数

-r
Use BSD algorithm, use 1K blocks (default)
-s, --sysv
Use System V algorithm, use 512-byte blocks
--help
Display help and exit
--version
Output version information and exit

FAQ

What is the sum command used for?

sum prints checksum and block counts for each FILE. With no FILE, or when FILE is -, reads standard input. The default BSD algorithm uses 1024-byte blocks, while the System V algorithm uses 512-byte blocks. This is a legacy utility provided for compatibility. The cksum command is preferred for new applications.

How do I run a basic sum example?

Run `sum [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -r do in sum?

Use BSD algorithm, use 1K blocks (default)