Displays the checksum and block count of a file.
sum [ -i ] [ -r ] [ -o ] [ File ... ]
The sum command reads the file specified by the File parameter and calculates a checksum and the number of 1024-byte blocks in that file. If no options are specified, a byte-by-byte algorithm, such as the BSD 4.3 default algorithm, is used. If no files are named, the standard input is read. The checksum and number of 1024-byte blocks are written to standard output. The sum command is generally used to determine if a file that has been copied or communicated over transmission lines is an exact copy of the original.
|-i||Allows the user to compute the checksum without including header information, if the input file is a binary file. If the input file is not a binary file, the checksum includes header information.|
|-r||Uses a byte-by-byte algorithm to compute the checksum. Using the -r flag is the same as using no options.|
|-o||Uses the word-by-word algorithm to compute the checksum. The sum command with the -o flag is compatible with the Version 2 sum command in terms of the checksum, but not the number of blocks.|
Note: The default is no longer the word-by-word computation algorithm; it is the BSD 4.3 default algorithm.
This command returns the following exit values:
|>0||An error occurred.|
To display the checksum of, and the number of 1024-byte blocks in, the file1 and file2 files, enter:
sum file1 file2
If the checksum of the file1 file is 32830, the checksum of the file2 file is 32481, and the file1 file contains one block, and the file2 contains four blocks, the sum command displays:
32830 1 file1 32481 4 file2
|/usr/bin/sum||Contains the sum command.|
The cksum command, wc command.
The File Systems Overview for Systems Management in AIX Version 4.3 System Management Guide: Operating System and Devices gives an explanation of what a file system is and why to use one.