2 UNIX / Linux cksum Command Examples

What is cksum?
2 cksum examples
Syntax and Options
Related Commands

What is cksum?

cksum computes a cyclic redundancy check (CRC) checksum for files and counts the number of bytes of a file.


2 cksum Examples

1. Find the cksum of a file

The cksum command displays the calculated 32 bit CRC code and also count the number of bytes of the input file.

$ ls -l sample.txt 
-rw-r--r-- 1 root root 91 2011-01-05 03:44 sample.txt

$ cksum sample.txt 
3704359389 91 sample.txt

2. Check whether two files are identical

You may find out whether two files are identical by checking the CRC of both the files as follows,

# cksum  file1.txt file2.txt
3704359389 91 file1.txt
3704359389 91 file2.txt

Normally, when the file gets copied to remote system, you might do the CRC matching between the source file and the destination file to ensure full copy.

Syntax and Options

cksum [FILE]
cksum [OPTIONS]

Short Option Long Option Option Description
–help to display help page and exit
–version to display the version information and exit


Related Commands

md5sum