sum(1) — Commands
OSF — Environment_Note_Added
NAME
sum − Displays the checksum and block count of a file
SYNOPSIS
sum [-or] [file ...]
The sum command reads file and calculates a 16-bit checksum and the number of blocks in the file. If the file argument is omitted, sum reads standard input.
FLAGS
-oUses an algorithm to compute the checksum using word-by-word computation.
-rUses an alternate algorithm to compute the checksum (rigorous byte-by-byte computation rather than the word-by-word computation). This is the default.
Note that the default is no longer the word-by-word computation algorithm.
DESCRIPTION
The checksum and number of blocks are written to standard output. The sum command is generally used to determine if a file that was copied or communicated over transmission lines is an exact copy of the original.
EXAMPLES
To display the checksum of datafile and the number of blocks in this file, enter:
sum datafile
If the checksum of datafile is 1605 and if the file contains 3 blocks, sum displays:
1605 3 datafile
ENVIRONMENT NOTES
This section describes system features that are not generic to OSF/1 but that are provided in this OSF/1 implementation.
System V Compatibility
The root of the directory tree that contains the commands modified for SVID-2 compliance is specified in the file /etc/svid2_path. You can use /etc/svid2_profile as the basis for, or to include in, your .profile. The file /etc/svid2_profile reads /etc/svid2_path and sets the first entries in the PATH environment variable so that the modified SVID-2 commands are found first.
The checksum algorithms for the default sum command and the SVID-2 compliant sum command are reversed. The SVID-2 compliant sum command uses the word-by-word algorithm by default and uses the byte-by-byte algorithm if you specify the −r option on the command line.
RELATED INFORMATION
Commands: wc(1).
Compatibility Notes
The default algorithm is no longer the word-by-word computation algorithm. It was changed to the 4.3BSD default algorithm.