1sum(1) User Commands sum(1)
2
3
4
6 sum - print checksum and block count for a file
7
9 /usr/bin/sum [-abBchHlLpPrRstTw] [-x method] [file...]
10
11
12 ksh93
13 sum [-abBchHlLpPrRstTw] [-x method] [file...]
14
15
17 The sum utility and ksh93 built-in command list the checksum, and for
18 most methods the block count, for each file argument. The standard
19 input is read if there are no file arguments.
20
21
22 The getconf(1) UNIVERSE determines the default sum method: att for the
23 att universe, bsd otherwise. The default for the other commands is the
24 command name itself. The att method is a true sum, all others are order
25 dependent.
26
27
28 Method names consist of a leading identifier and 0 or more options sep‐
29 arated by -.
30
31
32 getconf PATH_RESOLVE determines how symbolic links are handled. This
33 can be explicitly overridden by the --logical, --metaphysical, and
34 --physical options below. PATH_RESOLVE can be one of:
35
36 --logical Follow all symbolic links.
37
38
39 --metaphysical Follow command argument symbolic links, otherwise do
40 not follow.
41
42
43 --physical Do not follow symbolic links.
44
45
47 The following options are supported for /usr/bin/sum:
48
49 -a
50 --all
51
52 List the checksum for all files. Use with --total to list both
53 individual and total checksums and block counts.
54
55
56 -b
57 --binary
58
59 Read files in binary mode. This is the default.
60
61
62 -B
63 --scale=scale
64
65 Block count scale (bytes per block) override for methods that
66 include size in the output. The default is method-specific.
67
68
69 -c
70 --check
71
72 Each file is interpreted as the output from a previous sum. If
73 --header or --permissions was specified in the previous sum then
74 the checksum method is automatically determined, otherwise --method
75 must be specified. The listed checksum is compared with the current
76 value and a warning is issued for each file that does not match. If
77 file was generated by --permissions, then the file mode, user and
78 group are also checked. Empty lines, lines starting with #<space>,
79 or the line # are ignored. Lines containing no blanks are inter‐
80 preted as [no]name[=value] options:
81
82 method=name
83
84 Checksum method to apply to subsequent lines.
85
86
87 permissions
88
89 Subsequent lines were generated with --permissions.
90
91
92
93 -h
94 --header
95
96 Print the checksum method as the first output line. Used with
97 --check and --permissions.
98
99
100 -l
101 --list
102
103 Each file is interpreted as a list of files, one per line, that is
104 checksummed.
105
106
107 -p
108 --permissions
109
110 If --check is not specified then list the file mode, user and group
111 between the checksum and path. User and group matching the caller
112 are output as -. If --check is specified then the mode, user and
113 group for each path in file are updated if necessary to match those
114 in file. A warning is printed on the standard error for each
115 changed file.
116
117
118 -R
119 --recursive
120
121 Recursively checksum the contents of directories.
122
123
124 -t
125 --total
126
127 List only the total checksum and block count of all files. --all
128 --total lists each checksum and the total. The total checksum and
129 block count may be different from the checksum and block count of
130 the catenation of all files due to partial blocks that may occur
131 when the files are treated separately.
132
133
134 -T
135 --text
136 as 0.
137 Read files in text mode (for example, treat
138
139
140 -w
141 --warn
142
143 Warn about invalid --check lines. On by default; -w means --nowarn.
144
145
146 -x
147 --method|algorithm=method
148
149 Specifies the checksum method to apply. Parenthesized method
150 options are readonly implementation details.
151
152 att|sys5|s5|default
153
154 The system 5 release 4 checksum. This is the default for sum
155 when getconf UNIVERSE is att. This is the only true sum; all of
156 the other methods are order dependent.
157
158
159 ast4|32x4|tw
160
161 The ast 128 bit PRNG hash generated by catenating 4 separate 32
162 bit PNRG hashes. The block count is not printed.
163
164
165 bsd|ucb
166
167 The BSD checksum.
168
169
170 crc
171
172 32 bit CRC (cyclic redundancy check).
173
174 polynomial=mask
175
176 The 32 bit crc polynomial bitmask with implicit bit 32. The
177 default value is 0xedb88320.
178
179
180 done[=number]
181
182 XOR the final crc value with number. 0xffffffff is used if
183 number is omitted. The option value may be omitted. The
184 default value is 0.
185
186
187 init[=number]
188
189 The initial crc value. 0xffffffff is used if number is
190 omitted. The option value may be omitted. The default value
191 is 0.
192
193
194 rotate
195
196 XOR each input character with the high order crc byte
197 (instead of the low order).
198
199
200 size[=number]
201
202 Include the total number of bytes in the crc. number, if
203 specified, is first XOR'd into the size. The option value
204 may be omitted. The default value is 0.
205
206
207
208 prng
209
210 32 bit PRNG (pseudo random number generator) hash.
211
212 mpy=number The 32 bit PRNG multiplier. The default value
213 is 0x01000193.
214
215
216 add=number The 32 bit PRNG addend. The default value is
217 0.
218
219
220 init[=number] The PRNG initial value. 0xffffffff is used if
221 number is omitted. The option value may be
222 omitted. The default value is 0x811c9dc5.
223
224
225
226 md4|MD4
227
228 RFC1320 MD4 message digest. Cryptographically weak. The block
229 count is not printed. (version) md4 (solaris -lmd) 2005-07-26
230
231
232 md5|MD5
233
234 RFC1321 MD5 message digest. Cryptographically weak. The block
235 count is not printed. (version) md5 (solaris -lmd) 2005-07-26
236
237
238 sha1|SHA1|sha-1|SHA-1
239
240 RFC3174 / FIPS 180-1 SHA-1 secure hash algorithm 1. Crypto‐
241 graphically weak. The block count is not printed. (version)
242 sha1 (solaris -lmd) 2005-07-26
243
244
245 sha256|sha-256|SHA256|SHA-256
246
247 FIPS 180-2 SHA256 secure hash algorithm. The block count is not
248 printed. (version) sha256 (solaris -lmd) 2005-07-26
249
250
251 sha384|sha-384|SHA384|SHA-384
252
253 FIPS 180-2 SHA384 secure hash algorithm. The block count is not
254 printed. (version) sha384 (solaris -lmd) 2005-07-26
255
256
257 sha512|sha-512|SHA512|SHA-512
258
259 FIPS 180-2 SHA512 secure hash algorithm. The block count is not
260 printed. (version) sha512 (solaris -lmd) 2005-07-26
261
262
263 posix|cksum|std|standard
264
265 The posix 1003.2-1992 32 bit crc checksum. This is the default
266 cksum(1) method. Shorthand for crc-0x04c11db7-rotate-done-size.
267
268
269 zip
270
271 The zip(1) crc. Shorthand for crc-0xedb88320-init-done.
272
273
274 fddi
275
276 The FDDI crc. Shorthand for crc-0xedb88320-size=0xcc55cc55.
277
278
279 fnv|fnv1
280
281 The Fowler-Noll-Vo 32 bit PRNG hash with non-zero initializer
282 (FNV-1). Shorthand for prng-0x01000193-init=0x811c9dc5.
283
284
285 ast|strsum
286
287 The ast strsum PRNG hash. Shorthand for
288 prng-0x63c63cd9-add=0x9c39c33d.
289
290
291
292 -L
293 --logical|follow
294
295 Follow symbolic links when traversing directories. The default is
296 determined by getconf PATH_RESOLVE.
297
298
299 -H
300 --metaphysical
301
302 Follow command argument symbolic links, otherwise do not follow
303 symbolic links when traversing directories. The default is deter‐
304 mined by getconf PATH_RESOLVE.
305
306
307 -P
308 --physical
309
310 Do not follow symbolic links when traversing directories. The
311 default is determined by getconf PATH_RESOLVE.
312
313
314 -r
315 --bsd
316
317 Equivalent to --method=bsd --scale=512 for compatibility with other
318 sum implementations.
319
320
321 -s
322 --sysv
323
324 Equivalent to --method=sys5 for compatibility with other sum imple‐
325 mentations.
326
327
328 -S
329 --silent|status
330
331 No output for --check; 0 exit status means all sums matched, non-0
332 means at least one sum failed to match. Ignored for --permissions.
333
334
336 The following operands are supported:
337
338 file A path name of a file. If no files are named, the standard
339 input is used.
340
341
343 See largefile(5) for the description of the behavior of sum when
344 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
345
347 See environ(5) for descriptions of the following environment variables
348 that affect the execution of sum: LC_CTYPE, LC_MESSAGES, and NLSPATH.
349
351 The following exit values are returned.
352
353 0 Successful completion.
354
355
356 >0 An error occurred.
357
358
360 See attributes(5) for descriptions of the following attributes:
361
362
363
364
365 ┌─────────────────────────────┬─────────────────────────────┐
366 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
367 ├─────────────────────────────┼─────────────────────────────┤
368 │Availability │SUNWesu │
369 ├─────────────────────────────┼─────────────────────────────┤
370 │CSI │Enabled │
371 └─────────────────────────────┴─────────────────────────────┘
372
374 cksum(1), getconf(1), ksh93(1), sum(1B), wc(1), zip(1) , libmd(3LIB),
375 attributes(5), environ(5), largefile(5)
376
378 Read error is indistinguishable from end of file on most devices. Check
379 the block count.
380
382 Portable applications should use cksum(1). The default algorithm for
383 this command is defined in the POSIX standard and is identical across
384 platforms.
385
386
387 sum and usr/ucb/sum (see sum(1B)) return different checksums.
388
389
390
391SunOS 5.11 11 Aug 2009 sum(1)