md5sum Command
Purpose
Computes or verifies 128-bit message digests algorithm 5 (MD5) checksum of files.
Syntax
md5sum [ -b ] [ -c ] [ -h ] [ -t ] [ --tag ] [ -V ] [ checksum_file ] [ file ]...
Description
The md5sum command computes or verifies 128-bit MD5 checksum of files. In PowerVC virtual appliance, only read-only checksum computation and verification are allowed for security. File creation, modification, or advanced options are not allowed.
Flags
| Items | Description |
|---|---|
| -b | Reads file in binary mode. This behavior is the default behavior in Unix. The -b flag treats input as raw bytes and ignores newline conversions. |
| -c | Reads MD5 checksum from a file and verifies it against actual files. Reports OK or FAILED. The -c flag returns OK if the match is successful, otherwise it returns FAILED. |
| -h or --help | Displays help about the md5sum command. |
| -t | Reads file in text mode. The -t flag converts the Carriage Return Line Feed (CRLF) line endings in the input to Line Feed (LF). This flag must be used for cross-platform consistency. |
| --tag | Generates a Berkeley Software Distribution (BSD) style output. The output is displayed in the
following format:This option is useful for compatibility with bsdsum or older tools. |
| -V or --version | Displays version information. |
Positional arguments
| Item | Description |
|---|---|
| file | Specifies the file name that must be read. Multiple file names can be specifies separated by a white space. This option is mandatory with all the flags except the -c flag. |
| checksum_file | Specifies a file that contains pre-computed checksum lines to verify against the actual files. This option is mandatory with the -c flag. |
Examples
- To compute MD5 of a single file (default binary mode), enter the following
command:
md5sum document.pdf - To compute checksum of multiple files, enter the following
command:
md5sum *.jpg - To compute from the standard input (
stdin), enter the following command:echo -n "hello" | md5sum - To read files in text mode, enter the following
command:
md5sum -t report.txt - To display BSD-style output, enter the following
command:
md5sum --tag config.ini - To create a checksum file, enter the following
command:
md5sum *.bin > backups.md5 - To verify files against a checksum file, enter the following
command:
md5sum -c backups.md5 - To check a single file by using a checksum file, enter the following
command:
md5sum -c checksums.txt