Home > File & Directory Management > md5sum

md5sum: Calculate and Verify File MD5 Checksums

The md5sum command is used to calculate and verify the MD5 (Message-Digest Algorithm 5) checksum of files. It is useful for checking file integrity or ensuring that a file has not been corrupted during transmission.

Overview

md5sum generates a unique MD5 hash value for a file, allowing for quick detection of any changes. It is primarily used for verifying the integrity of downloaded files and plays a crucial role in confirming if a file is identical to its original.

Key Features

  • Calculate file MD5 checksums
  • Verify integrity using checksum files
  • Support for standard input/output

Key Options

The main options for the md5sum command control how checksums are calculated and verified.

Operation Control

Generated command:

Try combining the commands.

Description:

`md5sum` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Learn how to verify file integrity through various usage examples of the md5sum command.

Calculate MD5 checksum of a file

md5sum my_document.txt

Calculates and outputs the MD5 checksum for a specified file.

Save checksum to a file

md5sum my_document.txt > my_document.md5

Calculates the MD5 checksum of a file and saves the result to a separate file.

Verify integrity using a saved checksum file

md5sum -c my_document.md5

Verifies the integrity of the original file using a previously saved `.md5` file. Outputs 'OK' on success and 'FAILED' on failure.

Calculate checksums for multiple files

md5sum file1.txt file2.txt file3.txt

Calculates MD5 checksums for multiple files at once.

Calculate MD5 from standard input

echo "Hello World" | md5sum

Calculates the MD5 checksum of text passed via standard input instead of a file.

Show warnings on verification failure and continue

md5sum -c --warn my_files.md5

When a checksum file has multiple entries, this option displays warnings for failures but continues with the remaining verifications.

Tips & Precautions

Points to note and useful tips when using md5sum.

MD5 Security Vulnerabilities

MD5 is known to be vulnerable to collision attacks, meaning two files with different content can have the same MD5 checksum. Therefore, for security-critical applications, it is recommended to use stronger hash algorithms like SHA-256 instead of MD5.

Alternative Hash Algorithms

For higher security requirements, consider the following commands:

  • sha256sum: Calculate and verify SHA-256 checksums
  • sha512sum: Calculate and verify SHA-512 checksums

Utilizing Standard Input

md5sum can calculate checksums from data received via standard input (stdin) through a pipe (|). This is useful for checking the checksum of data that is not saved to a file.


Same category commands