Unleashed v1.4
[unleashed.git] / share / man / man1 / sum.1
blobf029b3b9a9cf2fc0c7ed19377baadfb81d0636a7
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
45 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
46 .\"
47 .TH SUM 1 "Aug 11, 2009"
48 .SH NAME
49 sum \- print checksum and block count for a file
50 .SH SYNOPSIS
51 .LP
52 .nf
53 \fB/usr/bin/sum\fR [-abBchHlLpPrRstTw] [-x method] [\fIfile\fR...]
54 .fi
56 .SS "ksh93"
57 .LP
58 .nf
59 sum [-abBchHlLpPrRstTw] [-x method] [\fIfile\fR...]
60 .fi
62 .SH DESCRIPTION
63 .sp
64 .LP
65 The \fBsum\fR utility and ksh93 built-in command list the checksum, and for
66 most methods the block count, for each file argument. The standard input is
67 read if there are no file arguments.
68 .sp
69 .LP
70 The \fBgetconf\fR(1) \fBUNIVERSE\fR determines the default sum method: att for
71 the att universe, bsd otherwise. The default for the other commands is the
72 command name itself. The att method is a true sum, all others are order
73 dependent.
74 .sp
75 .LP
76 Method names consist of a leading identifier and 0 or more options separated by
78 .sp
79 .LP
80 \fBgetconf\fR \fBPATH_RESOLVE\fR determines how symbolic links are handled.
81 This can be explicitly overridden by the \fB--logical\fR, \fB--metaphysical\fR,
82 and \fB--physical\fR options below. \fBPATH_RESOLVE\fR can be one of:
83 .sp
84 .ne 2
85 .na
86 \fB\fB--logical\fR\fR
87 .ad
88 .RS 18n
89 Follow all symbolic links.
90 .RE
92 .sp
93 .ne 2
94 .na
95 \fB\fB--metaphysical\fR\fR
96 .ad
97 .RS 18n
98 Follow command argument symbolic links, otherwise do not follow.
99 .RE
102 .ne 2
104 \fB\fB--physical\fR\fR
106 .RS 18n
107 Do not follow symbolic links.
110 .SH OPTIONS
113 The following options are supported for \fB/usr/bin/sum\fR:
115 .ne 2
117 \fB\fB-a\fR\fR
121 \fB\fB--all\fR\fR
123 .sp .6
124 .RS 4n
125 List the checksum for all files. Use with \fB--total\fR to list both individual
126 and total checksums and block counts.
130 .ne 2
132 \fB\fB-b\fR\fR
136 \fB\fB--binary\fR\fR
138 .sp .6
139 .RS 4n
140 Read files in binary mode. This is the default.
144 .ne 2
146 \fB\fB-B\fR\fR
150 \fB\fB--scale=scale\fR\fR
152 .sp .6
153 .RS 4n
154 Block count scale (bytes per block) override for methods that include size in
155 the output. The default is method-specific.
159 .ne 2
161 \fB\fB-c\fR\fR
165 \fB\fB--check\fR\fR
167 .sp .6
168 .RS 4n
169 Each file is interpreted as the output from a previous sum. If \fB--header\fR
170 or \fB--permissions\fR was specified in the previous sum then the checksum
171 method is automatically determined, otherwise \fB--method\fR must be specified.
172 The listed checksum is compared with the current value and a warning is issued
173 for each file that does not match. If file was generated by
174 \fB--permissions\fR, then the file mode, user and group are also checked. Empty
175 lines, lines starting with #<space>, or the line # are ignored. Lines
176 containing no blanks are interpreted as [no]name[=\fIvalue\fR] options:
178 .ne 2
180 \fB\fBmethod=name\fR\fR
182 .sp .6
183 .RS 4n
184 Checksum method to apply to subsequent lines.
188 .ne 2
190 \fB\fBpermissions\fR\fR
192 .sp .6
193 .RS 4n
194 Subsequent lines were generated with \fB--permissions\fR.
200 .ne 2
202 \fB\fB-h\fR\fR
206 \fB\fB--header\fR\fR
208 .sp .6
209 .RS 4n
210 Print the checksum method as the first output line. Used with \fB--check\fR and
211 \fB--permissions\fR.
215 .ne 2
217 \fB\fB-l\fR\fR
221 \fB\fB--list\fR\fR
223 .sp .6
224 .RS 4n
225 Each file is interpreted as a list of files, one per line, that is checksummed.
229 .ne 2
231 \fB\fB-p\fR\fR
235 \fB\fB--permissions\fR\fR
237 .sp .6
238 .RS 4n
239 If \fB--check\fR is not specified then list the file mode, user and group
240 between the checksum and path. User and group matching the caller are output as
241 -. If \fB--check\fR is specified then the mode, user and group for each path in
242 file are updated if necessary to match those in file. A warning is printed on
243 the standard error for each changed file.
247 .ne 2
249 \fB\fB-R\fR\fR
253 \fB\fB--recursive\fR\fR
255 .sp .6
256 .RS 4n
257 Recursively checksum the contents of directories.
261 .ne 2
263 \fB\fB-t\fR\fR
267 \fB\fB--total\fR\fR
269 .sp .6
270 .RS 4n
271 List only the total checksum and block count of all files. \fB--all\fR
272 \fB--total\fR lists each checksum and the total. The total checksum and block
273 count may be different from the checksum and block count of the catenation of
274 all files due to partial blocks that may occur when the files are treated
275 separately.
279 .ne 2
281 \fB\fB-T\fR\fR
285 \fB\fB--text\fR\fR
287 .sp .6
288 .RS 4n
289 Read files in text mode (for example, treat \er\en as \en).
293 .ne 2
295 \fB\fB-w\fR\fR
299 \fB\fB--warn\fR\fR
301 .sp .6
302 .RS 4n
303 Warn about invalid \fB--check\fR lines. On by default; \fB-w\fR means
304 \fB--nowarn\fR.
308 .ne 2
310 \fB\fB-x\fR\fR
314 \fB\fB--method|algorithm=method\fR\fR
316 .sp .6
317 .RS 4n
318 Specifies the checksum method to apply. Parenthesized method options are
319 readonly implementation details.
321 .ne 2
323 \fB\fBatt\fR|\fBsys5\fR|\fBs5\fR|\fBdefault\fR\fR
325 .sp .6
326 .RS 4n
327 The system 5 release 4 checksum. This is the default for sum when \fBgetconf\fR
328 \fBUNIVERSE\fR is \fBatt\fR. This is the only true sum; all of the other
329 methods are order dependent.
333 .ne 2
335 \fB\fBast4\fR|\fB32x4\fR|\fBtw\fR\fR
337 .sp .6
338 .RS 4n
339 The \fBast\fR 128 bit \fBPRNG\fR hash generated by catenating 4 separate 32 bit
340 \fBPNRG\fR hashes. The block count is not printed.
344 .ne 2
346 \fB\fBbsd\fR|\fBucb\fR\fR
348 .sp .6
349 .RS 4n
350 The BSD checksum.
354 .ne 2
356 \fB\fBcrc\fR\fR
358 .sp .6
359 .RS 4n
360 32 bit CRC (cyclic redundancy check).
362 .ne 2
364 \fB\fBpolynomial\fR=\fImask\fR\fR
366 .sp .6
367 .RS 4n
368 The 32 bit \fBcrc\fR polynomial bitmask with implicit bit 32. The default value
369 is 0xedb88320.
373 .ne 2
375 \fB\fBdone\fR[=\fInumber\fR]\fR
377 .sp .6
378 .RS 4n
379 XOR the final \fBcrc\fR value with number. 0xffffffff is used if number is
380 omitted. The option value may be omitted. The default value is 0.
384 .ne 2
386 \fB\fBinit\fR[=\fInumber\fR]\fR
388 .sp .6
389 .RS 4n
390 The initial \fBcrc\fR value. 0xffffffff is used if number is omitted. The
391 option value may be omitted. The default value is 0.
395 .ne 2
397 \fB\fBrotate\fR\fR
399 .sp .6
400 .RS 4n
401 XOR each input character with the high order \fBcrc\fR byte (instead of the low
402 order).
406 .ne 2
408 \fB\fBsize\fR[=\fInumber\fR]\fR
410 .sp .6
411 .RS 4n
412 Include the total number of bytes in the crc. number, if specified, is first
413 XOR'd into the size. The option value may be omitted. The default value is 0.
419 .ne 2
421 \fB\fBprng\fR\fR
423 .sp .6
424 .RS 4n
425 32 bit \fBPRNG\fR (pseudo random number generator) hash.
427 .ne 2
429 \fB\fBmpy\fR=\fInumber\fR\fR
431 .RS 17n
432 The 32 bit \fBPRNG\fR multiplier. The default value is 0x01000193.
436 .ne 2
438 \fB\fBadd\fR=\fInumber\fR\fR
440 .RS 17n
441 The 32 bit \fBPRNG\fR addend. The default value is 0.
445 .ne 2
447 \fB\fBinit\fR[=\fInumber\fR]\fR
449 .RS 17n
450 The \fBPRNG\fR initial value. 0xffffffff is used if number is omitted. The
451 option value may be omitted. The default value is 0x811c9dc5.
457 .ne 2
459 \fB\fBmd4\fR|\fBMD4\fR\fR
461 .sp .6
462 .RS 4n
463 \fBRFC1320\fR \fBMD4\fR message digest. Cryptographically weak. The block count
464 is not printed.  (version) \fBmd4\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
468 .ne 2
470 \fB\fBmd5\fR|\fBMD5\fR\fR
472 .sp .6
473 .RS 4n
474 \fBRFC1321\fR \fBMD5\fR message digest. Cryptographically weak. The block count
475 is not printed. (version) \fBmd5\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
479 .ne 2
481 \fB\fBsha1\fR|\fBSHA1\fR|\fBsha-1\fR|\fBSHA-1\fR\fR
483 .sp .6
484 .RS 4n
485 \fBRFC3174\fR / \fBFIPS 180-1\fR \fBSHA-1\fR secure hash algorithm 1.
486 Cryptographically weak. The block count is not printed. (version) \fBsha1\fR
487 (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
491 .ne 2
493 \fB\fBsha256\fR|\fBsha-256\fR|\fBSHA256\fR|\fBSHA-256\fR\fR
495 .sp .6
496 .RS 4n
497 \fBFIPS 180-2\fR \fBSHA256\fR secure hash algorithm. The block count is not
498 printed. (version) \fBsha256\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
502 .ne 2
504 \fB\fBsha384\fR|\fBsha-384\fR|\fBSHA384\fR|\fBSHA-384\fR\fR
506 .sp .6
507 .RS 4n
508 \fBFIPS 180-2\fR \fBSHA384\fR secure hash algorithm. The block count is not
509 printed. (version) \fBsha384\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
513 .ne 2
515 \fB\fBsha512\fR|\fBsha-512\fR|\fBSHA512\fR|\fBSHA-512\fR\fR
517 .sp .6
518 .RS 4n
519 \fBFIPS 180-2\fR \fBSHA512\fR secure hash algorithm. The block count is not
520 printed. (version) \fBsha512\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
524 .ne 2
526 \fB\fBposix\fR|\fBcksum\fR|\fBstd\fR|\fBstandard\fR\fR
528 .sp .6
529 .RS 4n
530 The \fBposix 1003.2-1992\fR 32 bit \fBcrc\fR checksum. This is the default
531 \fBcksum\fR(1) method. Shorthand for \fBcrc-0x04c11db7-rotate-done-size\fR.
535 .ne 2
537 \fB\fBzip\fR\fR
539 .sp .6
540 .RS 4n
541 The \fBzip\fR(1) \fBcrc\fR. Shorthand for \fBcrc-0xedb88320-init-done\fR.
545 .ne 2
547 \fB\fBfddi\fR\fR
549 .sp .6
550 .RS 4n
551 The \fBFDDI\fR \fBcrc\fR. Shorthand for
552 \fBcrc-0xedb88320-size\fR=\fB0xcc55cc55\fR.
556 .ne 2
558 \fB\fBfnv\fR|\fBfnv1\fR\fR
560 .sp .6
561 .RS 4n
562 The \fBFowler-Noll-Vo\fR 32 bit \fBPRNG\fR hash with non-zero initializer
563 (\fBFNV-1\fR). Shorthand for \fBprng-0x01000193-init\fR=\fB0x811c9dc5\fR.
567 .ne 2
569 \fB\fBast\fR|\fBstrsum\fR\fR
571 .sp .6
572 .RS 4n
573 The \fBast\fR \fBstrsum\fR \fBPRNG\fR hash. Shorthand for
574 \fBprng-0x63c63cd9-add\fR=\fB0x9c39c33d\fR.
580 .ne 2
582 \fB\fB-L\fR\fR
586 \fB\fB--logical\fR|\fBfollow\fR\fR
588 .sp .6
589 .RS 4n
590 Follow symbolic links when traversing directories. The default is determined by
591 \fBgetconf\fR \fBPATH_RESOLVE\fR.
595 .ne 2
597 \fB\fB-H\fR\fR
601 \fB\fB--metaphysical\fR\fR
603 .sp .6
604 .RS 4n
605 Follow command argument symbolic links, otherwise do not follow symbolic links
606 when traversing directories. The default is determined by \fBgetconf\fR
607 \fBPATH_RESOLVE\fR.
611 .ne 2
613 \fB\fB-P\fR\fR
617 \fB\fB--physical\fR\fR
619 .sp .6
620 .RS 4n
621 Do not follow symbolic links when traversing directories. The default is
622 determined by \fBgetconf\fR \fBPATH_RESOLVE\fR.
626 .ne 2
628 \fB\fB-r\fR\fR
632 \fB\fB--bsd\fR\fR
634 .sp .6
635 .RS 4n
636 Equivalent to \fB--method=bsd\fR \fB--scale=512\fR for compatibility with other
637 sum implementations.
641 .ne 2
643 \fB\fB-s\fR\fR
647 \fB\fB--sysv\fR\fR
649 .sp .6
650 .RS 4n
651 Equivalent to \fB--method=sys5\fR for compatibility with other sum
652 implementations.
656 .ne 2
658 \fB\fB-S\fR\fR
662 \fB\fB--silent\fR|\fBstatus\fR\fR
664 .sp .6
665 .RS 4n
666 No output for \fB--check\fR;  0 exit status means all sums matched, non-0 means
667 at least one sum failed to match. Ignored for \fB--permissions\fR.
670 .SH OPERANDS
673 The following operands are supported:
675 .ne 2
677 \fB\fIfile\fR\fR
679 .RS 8n
680 A path name of a file.  If no files are named, the standard input is used.
683 .SH ENVIRONMENT VARIABLES
686 See \fBenviron\fR(5) for descriptions of the following environment variables
687 that affect the execution of  \fBsum\fR: \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and
688 \fBNLSPATH\fR.
689 .SH EXIT STATUS
692 The following exit values are returned.
694 .ne 2
696 \fB\fB0\fR\fR
698 .RS 6n
699 Successful completion.
703 .ne 2
705 \fB\fB>0\fR\fR
707 .RS 6n
708 An error occurred.
711 .SH ATTRIBUTES
714 See \fBattributes\fR(5) for descriptions of the following attributes:
719 box;
720 c | c
721 l | l .
722 ATTRIBUTE TYPE  ATTRIBUTE VALUE
724 CSI     Enabled
727 .SH SEE ALSO
730 \fBcksum\fR(1), \fBgetconf\fR(1), \fBksh93\fR(1), \fBsum\fR(1B), \fBwc\fR(1),
731 \fBzip\fR(1) , \fBlibmd\fR(3LIB), \fBattributes\fR(5), \fBenviron\fR(5)
732 .SH DIAGNOSTICS
735 \fBRead error\fR is indistinguishable from end of file on most devices. Check
736 the block count.
737 .SH NOTES
740 Portable applications should use \fBcksum\fR(1). The default algorithm for this
741 command is defined in the POSIX standard and is identical across platforms.