Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

sum - print checksum and block count of a file

&pagelevel(4)&pagelevel

sum calculates and prints a checksum for the named file, and also prints the space used by the file, in 512-byte blocks. The output is written to standard output.
sum may be useful for checking that a file has arrived complete and unchanged after a file transfer.


Syntax


sum[ -r][ datei]...

-r

Uses an alternate algorithm to compute the checksum and prints a different checksum.

file

Name of the file whose checksum is to be calculated. Both ordinary files and directories may be specified. You may name more than one file.

file not specified:
sum reads from standard input.

Caution!
The algorithms used in computing the checksum may not be portable. Different checksums may thus be produced for the same file when sum is run on different systems.

Locale

The following environment variables affect the execution of sum:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other.

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example 1

Checksum of the file months using the first algorithm:

$ sum months

6658 1 month

Example 2

Checksum of the file months using the second algorithm:

$ sum -r months

62412 1 month

See also

cksum, wc