9070 Remove wanboot from gate
[unleashed.git] / usr / src / man / man1 / sum.1
blobd637577eaf8b10ac7c928f423fe0452ce7f84183
1 '\" te
2 .\" Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at  http://www.opengroup.org/bookstore/.
6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
7 .\" are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical
8 .\" and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\"  This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
11 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with
12 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH SUM 1 "Aug 11, 2009"
14 .SH NAME
15 sum \- print checksum and block count for a file
16 .SH SYNOPSIS
17 .LP
18 .nf
19 \fB/usr/bin/sum\fR [-abBchHlLpPrRstTw] [-x method] [\fIfile\fR...]
20 .fi
22 .SS "ksh93"
23 .LP
24 .nf
25 sum [-abBchHlLpPrRstTw] [-x method] [\fIfile\fR...]
26 .fi
28 .SH DESCRIPTION
29 .sp
30 .LP
31 The \fBsum\fR utility and ksh93 built-in command list the checksum, and for
32 most methods the block count, for each file argument. The standard input is
33 read if there are no file arguments.
34 .sp
35 .LP
36 The \fBgetconf\fR(1) \fBUNIVERSE\fR determines the default sum method: att for
37 the att universe, bsd otherwise. The default for the other commands is the
38 command name itself. The att method is a true sum, all others are order
39 dependent.
40 .sp
41 .LP
42 Method names consist of a leading identifier and 0 or more options separated by
44 .sp
45 .LP
46 \fBgetconf\fR \fBPATH_RESOLVE\fR determines how symbolic links are handled.
47 This can be explicitly overridden by the \fB--logical\fR, \fB--metaphysical\fR,
48 and \fB--physical\fR options below. \fBPATH_RESOLVE\fR can be one of:
49 .sp
50 .ne 2
51 .na
52 \fB\fB--logical\fR\fR
53 .ad
54 .RS 18n
55 Follow all symbolic links.
56 .RE
58 .sp
59 .ne 2
60 .na
61 \fB\fB--metaphysical\fR\fR
62 .ad
63 .RS 18n
64 Follow command argument symbolic links, otherwise do not follow.
65 .RE
67 .sp
68 .ne 2
69 .na
70 \fB\fB--physical\fR\fR
71 .ad
72 .RS 18n
73 Do not follow symbolic links.
74 .RE
76 .SH OPTIONS
77 .sp
78 .LP
79 The following options are supported for \fB/usr/bin/sum\fR:
80 .sp
81 .ne 2
82 .na
83 \fB\fB-a\fR\fR
84 .ad
85 .br
86 .na
87 \fB\fB--all\fR\fR
88 .ad
89 .sp .6
90 .RS 4n
91 List the checksum for all files. Use with \fB--total\fR to list both individual
92 and total checksums and block counts.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fB-b\fR\fR
99 .ad
102 \fB\fB--binary\fR\fR
104 .sp .6
105 .RS 4n
106 Read files in binary mode. This is the default.
110 .ne 2
112 \fB\fB-B\fR\fR
116 \fB\fB--scale=scale\fR\fR
118 .sp .6
119 .RS 4n
120 Block count scale (bytes per block) override for methods that include size in
121 the output. The default is method-specific.
125 .ne 2
127 \fB\fB-c\fR\fR
131 \fB\fB--check\fR\fR
133 .sp .6
134 .RS 4n
135 Each file is interpreted as the output from a previous sum. If \fB--header\fR
136 or \fB--permissions\fR was specified in the previous sum then the checksum
137 method is automatically determined, otherwise \fB--method\fR must be specified.
138 The listed checksum is compared with the current value and a warning is issued
139 for each file that does not match. If file was generated by
140 \fB--permissions\fR, then the file mode, user and group are also checked. Empty
141 lines, lines starting with #<space>, or the line # are ignored. Lines
142 containing no blanks are interpreted as [no]name[=\fIvalue\fR] options:
144 .ne 2
146 \fB\fBmethod=name\fR\fR
148 .sp .6
149 .RS 4n
150 Checksum method to apply to subsequent lines.
154 .ne 2
156 \fB\fBpermissions\fR\fR
158 .sp .6
159 .RS 4n
160 Subsequent lines were generated with \fB--permissions\fR.
166 .ne 2
168 \fB\fB-h\fR\fR
172 \fB\fB--header\fR\fR
174 .sp .6
175 .RS 4n
176 Print the checksum method as the first output line. Used with \fB--check\fR and
177 \fB--permissions\fR.
181 .ne 2
183 \fB\fB-l\fR\fR
187 \fB\fB--list\fR\fR
189 .sp .6
190 .RS 4n
191 Each file is interpreted as a list of files, one per line, that is checksummed.
195 .ne 2
197 \fB\fB-p\fR\fR
201 \fB\fB--permissions\fR\fR
203 .sp .6
204 .RS 4n
205 If \fB--check\fR is not specified then list the file mode, user and group
206 between the checksum and path. User and group matching the caller are output as
207 -. If \fB--check\fR is specified then the mode, user and group for each path in
208 file are updated if necessary to match those in file. A warning is printed on
209 the standard error for each changed file.
213 .ne 2
215 \fB\fB-R\fR\fR
219 \fB\fB--recursive\fR\fR
221 .sp .6
222 .RS 4n
223 Recursively checksum the contents of directories.
227 .ne 2
229 \fB\fB-t\fR\fR
233 \fB\fB--total\fR\fR
235 .sp .6
236 .RS 4n
237 List only the total checksum and block count of all files. \fB--all\fR
238 \fB--total\fR lists each checksum and the total. The total checksum and block
239 count may be different from the checksum and block count of the catenation of
240 all files due to partial blocks that may occur when the files are treated
241 separately.
245 .ne 2
247 \fB\fB-T\fR\fR
251 \fB\fB--text\fR\fR
253 .sp .6
254 .RS 4n
255 Read files in text mode (for example, treat \er\en as \en).
259 .ne 2
261 \fB\fB-w\fR\fR
265 \fB\fB--warn\fR\fR
267 .sp .6
268 .RS 4n
269 Warn about invalid \fB--check\fR lines. On by default; \fB-w\fR means
270 \fB--nowarn\fR.
274 .ne 2
276 \fB\fB-x\fR\fR
280 \fB\fB--method|algorithm=method\fR\fR
282 .sp .6
283 .RS 4n
284 Specifies the checksum method to apply. Parenthesized method options are
285 readonly implementation details.
287 .ne 2
289 \fB\fBatt\fR|\fBsys5\fR|\fBs5\fR|\fBdefault\fR\fR
291 .sp .6
292 .RS 4n
293 The system 5 release 4 checksum. This is the default for sum when \fBgetconf\fR
294 \fBUNIVERSE\fR is \fBatt\fR. This is the only true sum; all of the other
295 methods are order dependent.
299 .ne 2
301 \fB\fBast4\fR|\fB32x4\fR|\fBtw\fR\fR
303 .sp .6
304 .RS 4n
305 The \fBast\fR 128 bit \fBPRNG\fR hash generated by catenating 4 separate 32 bit
306 \fBPNRG\fR hashes. The block count is not printed.
310 .ne 2
312 \fB\fBbsd\fR|\fBucb\fR\fR
314 .sp .6
315 .RS 4n
316 The BSD checksum.
320 .ne 2
322 \fB\fBcrc\fR\fR
324 .sp .6
325 .RS 4n
326 32 bit CRC (cyclic redundancy check).
328 .ne 2
330 \fB\fBpolynomial\fR=\fImask\fR\fR
332 .sp .6
333 .RS 4n
334 The 32 bit \fBcrc\fR polynomial bitmask with implicit bit 32. The default value
335 is 0xedb88320.
339 .ne 2
341 \fB\fBdone\fR[=\fInumber\fR]\fR
343 .sp .6
344 .RS 4n
345 XOR the final \fBcrc\fR value with number. 0xffffffff is used if number is
346 omitted. The option value may be omitted. The default value is 0.
350 .ne 2
352 \fB\fBinit\fR[=\fInumber\fR]\fR
354 .sp .6
355 .RS 4n
356 The initial \fBcrc\fR value. 0xffffffff is used if number is omitted. The
357 option value may be omitted. The default value is 0.
361 .ne 2
363 \fB\fBrotate\fR\fR
365 .sp .6
366 .RS 4n
367 XOR each input character with the high order \fBcrc\fR byte (instead of the low
368 order).
372 .ne 2
374 \fB\fBsize\fR[=\fInumber\fR]\fR
376 .sp .6
377 .RS 4n
378 Include the total number of bytes in the crc. number, if specified, is first
379 XOR'd into the size. The option value may be omitted. The default value is 0.
385 .ne 2
387 \fB\fBprng\fR\fR
389 .sp .6
390 .RS 4n
391 32 bit \fBPRNG\fR (pseudo random number generator) hash.
393 .ne 2
395 \fB\fBmpy\fR=\fInumber\fR\fR
397 .RS 17n
398 The 32 bit \fBPRNG\fR multiplier. The default value is 0x01000193.
402 .ne 2
404 \fB\fBadd\fR=\fInumber\fR\fR
406 .RS 17n
407 The 32 bit \fBPRNG\fR addend. The default value is 0.
411 .ne 2
413 \fB\fBinit\fR[=\fInumber\fR]\fR
415 .RS 17n
416 The \fBPRNG\fR initial value. 0xffffffff is used if number is omitted. The
417 option value may be omitted. The default value is 0x811c9dc5.
423 .ne 2
425 \fB\fBmd4\fR|\fBMD4\fR\fR
427 .sp .6
428 .RS 4n
429 \fBRFC1320\fR \fBMD4\fR message digest. Cryptographically weak. The block count
430 is not printed.  (version) \fBmd4\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
434 .ne 2
436 \fB\fBmd5\fR|\fBMD5\fR\fR
438 .sp .6
439 .RS 4n
440 \fBRFC1321\fR \fBMD5\fR message digest. Cryptographically weak. The block count
441 is not printed. (version) \fBmd5\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
445 .ne 2
447 \fB\fBsha1\fR|\fBSHA1\fR|\fBsha-1\fR|\fBSHA-1\fR\fR
449 .sp .6
450 .RS 4n
451 \fBRFC3174\fR / \fBFIPS 180-1\fR \fBSHA-1\fR secure hash algorithm 1.
452 Cryptographically weak. The block count is not printed. (version) \fBsha1\fR
453 (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
457 .ne 2
459 \fB\fBsha256\fR|\fBsha-256\fR|\fBSHA256\fR|\fBSHA-256\fR\fR
461 .sp .6
462 .RS 4n
463 \fBFIPS 180-2\fR \fBSHA256\fR secure hash algorithm. The block count is not
464 printed. (version) \fBsha256\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
468 .ne 2
470 \fB\fBsha384\fR|\fBsha-384\fR|\fBSHA384\fR|\fBSHA-384\fR\fR
472 .sp .6
473 .RS 4n
474 \fBFIPS 180-2\fR \fBSHA384\fR secure hash algorithm. The block count is not
475 printed. (version) \fBsha384\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
479 .ne 2
481 \fB\fBsha512\fR|\fBsha-512\fR|\fBSHA512\fR|\fBSHA-512\fR\fR
483 .sp .6
484 .RS 4n
485 \fBFIPS 180-2\fR \fBSHA512\fR secure hash algorithm. The block count is not
486 printed. (version) \fBsha512\fR (\fBsolaris\fR \fB-lmd\fR) 2005-07-26
490 .ne 2
492 \fB\fBposix\fR|\fBcksum\fR|\fBstd\fR|\fBstandard\fR\fR
494 .sp .6
495 .RS 4n
496 The \fBposix 1003.2-1992\fR 32 bit \fBcrc\fR checksum. This is the default
497 \fBcksum\fR(1) method. Shorthand for \fBcrc-0x04c11db7-rotate-done-size\fR.
501 .ne 2
503 \fB\fBzip\fR\fR
505 .sp .6
506 .RS 4n
507 The \fBzip\fR(1) \fBcrc\fR. Shorthand for \fBcrc-0xedb88320-init-done\fR.
511 .ne 2
513 \fB\fBfddi\fR\fR
515 .sp .6
516 .RS 4n
517 The \fBFDDI\fR \fBcrc\fR. Shorthand for
518 \fBcrc-0xedb88320-size\fR=\fB0xcc55cc55\fR.
522 .ne 2
524 \fB\fBfnv\fR|\fBfnv1\fR\fR
526 .sp .6
527 .RS 4n
528 The \fBFowler-Noll-Vo\fR 32 bit \fBPRNG\fR hash with non-zero initializer
529 (\fBFNV-1\fR). Shorthand for \fBprng-0x01000193-init\fR=\fB0x811c9dc5\fR.
533 .ne 2
535 \fB\fBast\fR|\fBstrsum\fR\fR
537 .sp .6
538 .RS 4n
539 The \fBast\fR \fBstrsum\fR \fBPRNG\fR hash. Shorthand for
540 \fBprng-0x63c63cd9-add\fR=\fB0x9c39c33d\fR.
546 .ne 2
548 \fB\fB-L\fR\fR
552 \fB\fB--logical\fR|\fBfollow\fR\fR
554 .sp .6
555 .RS 4n
556 Follow symbolic links when traversing directories. The default is determined by
557 \fBgetconf\fR \fBPATH_RESOLVE\fR.
561 .ne 2
563 \fB\fB-H\fR\fR
567 \fB\fB--metaphysical\fR\fR
569 .sp .6
570 .RS 4n
571 Follow command argument symbolic links, otherwise do not follow symbolic links
572 when traversing directories. The default is determined by \fBgetconf\fR
573 \fBPATH_RESOLVE\fR.
577 .ne 2
579 \fB\fB-P\fR\fR
583 \fB\fB--physical\fR\fR
585 .sp .6
586 .RS 4n
587 Do not follow symbolic links when traversing directories. The default is
588 determined by \fBgetconf\fR \fBPATH_RESOLVE\fR.
592 .ne 2
594 \fB\fB-r\fR\fR
598 \fB\fB--bsd\fR\fR
600 .sp .6
601 .RS 4n
602 Equivalent to \fB--method=bsd\fR \fB--scale=512\fR for compatibility with other
603 sum implementations.
607 .ne 2
609 \fB\fB-s\fR\fR
613 \fB\fB--sysv\fR\fR
615 .sp .6
616 .RS 4n
617 Equivalent to \fB--method=sys5\fR for compatibility with other sum
618 implementations.
622 .ne 2
624 \fB\fB-S\fR\fR
628 \fB\fB--silent\fR|\fBstatus\fR\fR
630 .sp .6
631 .RS 4n
632 No output for \fB--check\fR;  0 exit status means all sums matched, non-0 means
633 at least one sum failed to match. Ignored for \fB--permissions\fR.
636 .SH OPERANDS
639 The following operands are supported:
641 .ne 2
643 \fB\fIfile\fR\fR
645 .RS 8n
646 A path name of a file.  If no files are named, the standard input is used.
649 .SH USAGE
652 See \fBlargefile\fR(5) for the description of the behavior of \fBsum\fR when
653 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
654 .SH ENVIRONMENT VARIABLES
657 See \fBenviron\fR(5) for descriptions of the following environment variables
658 that affect the execution of  \fBsum\fR: \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and
659 \fBNLSPATH\fR.
660 .SH EXIT STATUS
663 The following exit values are returned.
665 .ne 2
667 \fB\fB0\fR\fR
669 .RS 6n
670 Successful completion.
674 .ne 2
676 \fB\fB>0\fR\fR
678 .RS 6n
679 An error occurred.
682 .SH ATTRIBUTES
685 See \fBattributes\fR(5) for descriptions of the following attributes:
690 box;
691 c | c
692 l | l .
693 ATTRIBUTE TYPE  ATTRIBUTE VALUE
695 CSI     Enabled
698 .SH SEE ALSO
701 \fBcksum\fR(1), \fBgetconf\fR(1), \fBksh93\fR(1), \fBsum\fR(1B), \fBwc\fR(1),
702 \fBzip\fR(1) , \fBlibmd\fR(3LIB), \fBattributes\fR(5), \fBenviron\fR(5),
703 \fBlargefile\fR(5)
704 .SH DIAGNOSTICS
707 \fBRead error\fR is indistinguishable from end of file on most devices. Check
708 the block count.
709 .SH NOTES
712 Portable applications should use \fBcksum\fR(1). The default algorithm for this
713 command is defined in the POSIX standard and is identical across platforms.
716 \fBsum\fR and \fBusr/ucb/sum\fR (see \fBsum\fR(1B)) return different checksums.