Checksum and File Integrity Commands in Linux (original) (raw)

Last Updated : 7 Jan, 2026

Checksum and file integrity commands in Linux are used to verify whether files have been altered, corrupted, or tampered with. These commands generate hash or checksum values based on file content, allowing users to compare and confirm file integrity during transfers, backups, or security checks.

These commands are mainly used to:

Below are the commonly used Checksum and File Integrity Commands in Linux

checksum_and_file_integrity_commands

1. md5sum

The md5sum command generates and verifies an MD5 hash value for files.

**Syntax:

md5sum file_name

**Example:

md5sum sample.txt

**Output:

md5sum

2. cksum

The cksum command calculates a CRC checksum along with the file size.

**Syntax:

cksum file_name

**Example:

cksum sample.txt

**Output:

cksum

3. sum

The sum command calculates a simple checksum for files.

**Syntax:

sum file_name

**Example:

sum sample.txt

**Output:

sum

How Checksums Work in Linux

When to Use Checksum Commands

Checksum commands are used whenever you need to verify that a file has not been altered, corrupted, or tampered with during download, transfer, backup, or storage.

After Downloading Files to Verify They Are Not Corrupted

md5sum software.zip

Following File Transfers Between Systems or Networks

md5sum file.txt

After Restoring Files From Backups

cksum backup.tar

md5sum /etc/passwd > passwd.hash

md5sum -c passwd.hash