[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These commands generate just a few numbers representing entire contents of files.
6.1 wc
: Print byte, word, and line countsPrint byte, word, and line counts. 6.2 sum
: Print checksum and block countsPrint checksum and block counts. 6.3 cksum
: Print CRC checksum and byte countsPrint CRC checksum and byte counts. 6.4 md5sum
: Print or check message-digestsPrint or check message-digests.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
wc
: Print byte, word, and line counts
wc
counts the number of bytes, characters, whitespace-separated
words, and newlines in each given file, or standard input if none
are given or for a file of `-'. Synopsis:
wc [option]... [file]... |
wc
prints one line of counts for each file, and if the file was
given as an argument, it prints the file name following the counts. If
more than one file is given, wc
prints a final line
containing the cumulative counts, with the file name `total'. The
counts are printed in this order: newlines, words, characters, bytes.
By default, each count is output right-justified in a 7-byte field with
one space between fields so that the numbers and file names line up nicely
in columns. However, POSIX requires that there be exactly one space
separating columns. You can make wc
use the POSIX-mandated
output format by setting the POSIXLY_CORRECT
environment variable.
By default, wc
prints three counts: the newline, words, and byte
counts. Options can specify that only certain counts be printed.
Options do not undo others previously given, so
wc --bytes --words |
prints both the byte counts and the word counts.
With the --max-line-length
option, wc
prints the length
of the longest line per file, and if there is more than one file it
prints the maximum (not the sum) of those lengths.
The program accepts the following options. Also see 2. Common options.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
sum
: Print checksum and block counts
sum
computes a 16-bit checksum for each given file, or
standard input if none are given or for a file of `-'. Synopsis:
sum [option]... [file]... |
sum
prints the checksum for each file followed by the
number of blocks in the file (rounded up). If more than one file
is given, file names are also printed (by default). (With the
`--sysv' option, corresponding file names are printed when there is
at least one file argument.)
By default, GNU sum
computes checksums using an algorithm
compatible with BSD sum
and prints file sizes in units of
1024-byte blocks.
The program accepts the following options. Also see 2. Common options.
sum
. Unless `-s' was also
given, it has no effect.
sum
's default, and print file sizes in units of 512-byte blocks.
sum
is provided for compatibility; the cksum
program (see
next section) is preferable in new applications.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cksum
: Print CRC checksum and byte counts
cksum
computes a cyclic redundancy check (CRC) checksum for each
given file, or standard input if none are given or for a
file of `-'. Synopsis:
cksum [option]... [file]... |
cksum
prints the CRC checksum for each file along with the number
of bytes in the file, and the filename unless no arguments were given.
cksum
is typically used to ensure that files
transferred by unreliable means (e.g., netnews) have not been corrupted,
by comparing the cksum
output for the received files with the
cksum
output for the original files (typically given in the
distribution).
The CRC algorithm is specified by the POSIX standard. It is not
compatible with the BSD or System V sum
algorithms (see the
previous section); it is more robust.
The only options are `--help' and `--version'. See section 2. Common options.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
md5sum
: Print or check message-digests
md5sum
computes a 128-bit checksum (or fingerprint or
message-digest) for each specified file.
If a file is specified as `-' or if no files are given
md5sum
computes the checksum for the standard input.
md5sum
can also determine whether a file and checksum are
consistent. Synopses:
md5sum [option]... [file]... md5sum [option]... --check [file] |
For each file, `md5sum' outputs the MD5 checksum, a flag indicating a binary or text input file, and the filename. If file is omitted or specified as `-', standard input is read.
The program accepts the following options. Also see 2. Common options.
md5sum
is usually the output of
a prior, checksum-generating run of `md5sum'.
Each valid line of input consists of an MD5 checksum, a binary/text
flag, and then a filename.
Binary files are marked with `*', text with ` '.
For each such line, md5sum
reads the named file and computes its
MD5 checksum. Then, if the computed message digest does not match the
one on the line with the filename, the file is noted as having
failed the test. Otherwise, the file passes the test.
By default, for each valid line, one line is written to standard
output indicating whether the named file passed the test.
After all checks have been performed, if there were any failures,
a warning is issued to standard error.
Use the `--status' option to inhibit that output.
If any listed file cannot be opened or read, if any valid line has
an MD5 checksum inconsistent with the associated file, or if no valid
line is found, md5sum
exits with nonzero status. Otherwise,
it exits successfully.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |