The Linux sum command is used to output checksums and block counts for files.
Linux sum command Function Description
Use the sum command to output checksum and block count for each specified file.
Linux sum Command Syntax
sum [Option] [File]
The meaning of each option in the command is shown in the table.
Option | Description |
---|---|
-r |
Using the BSD summation algorithm, in 1KB blocks |
-s |
Use System V summation algorithm, 512 bytes as a block |
Linux sum command Examples
Calculate file checksum
sum apidemos.com/ccc.txt
Output:
Output checksum and block count for /root/anaconda-ks.cfg file
[root@rhel ~]# sum /root/anaconda-ks.cfg
00220 9
Output checksum and block count for /root/anaconda-ks.cfg file in 512-byte blocks using System V summing algorithm
[root@rhel ~]# sum -s /root/anaconda-ks.cfg
19269 17 /root/anaconda-ks.cfg