sum

compute checksum and block count for file 

Command


SYNOPSIS

sum [-ciprt] [file ...]


DESCRIPTION

The sum command calculates a checksum for each input file. It also displays the number of 512-byte blocks in each file. If you do not specify any files or you specify - as the file name, sum reads the standard input. The checksum is useful as a quick way to compare a file or files that have been moved from one system to another to ensure that no data have been lost.

sum differs from cksum only in the format of the output. sum's output has the form

checksum	blockcount	filename

where blockcount is the number of 512-byte blocks in the file.

sum can calculate checksums in a variety of ways. The default checksum algorithm produces a 16-bit unsigned integer resulting from the arithmetic addition of each input byte. This checksum algorithm is insensitive to byte order.

Options

-c 

uses a standard 16-bit Cyclical Redundancy Check (CRC-16).

-i 

uses the CCITT standard Cyclic Redundancy Check (CRC-CCITT). Data communications network protocols often use a cyclic redundancy check to ensure proper transmission. This algorithm is more likely to produce a different sum for inputs which differ only in byte order.

-p 

uses the POSIX.2 checksum algorithm.

-r 

enables the use of an alternate checksum algorithm which has the advantage of being sensitive to byte order.

-t 

produces a line containing the total number of blocks of data read, as well as the checksum of the concatenation of the input files.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following:

— inability to open input file
— error reading the input file
2 

Unknown command line option.


PORTABILITY

x/OPEN Portability Guide 4.0. Windows 2000. Windows XP. Windows Server 2003. Windows Vista. The default checksum algorithm is compatible with UNIX System V.2 and later. The -r algorithm is also available on UNIX System V.2 and is the default algorithm for Berkeley and Version 7. The -c, -i and -t options are not available under UNIX.


AVAILABILITY

MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
cksum, cmp, diff, ls, wc


MKS Toolkit 9.2 Documentation Build 16.