• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

md5sum Command Examples in Linux

by admin

The md5sum command is used to calculate the hash value of a file or standard input using the MD5 hash function. You can also use the -c option to specify a file containing MD5 hashes and the file names they apply to; md5sum will calculate the hashes of the files listed, and then compare them to the hash values listed. The results will let you know if each file passed, failed, or could not be found.

MD5 hashes are 128-bits in length. Like many other hash values, they are typically represented in hexadecimal format (32 characters for MD5). The following is the hash value of the string “Linux”:

edc9f0a5a5d57797bf68e37364743831

Syntax

The syntax of the md5sum command is:

# md5sum [options] [file name]

md5sum Command Examples

1. Calculate the MD5 checksum for a file:

# md5sum path/to/file

2. Calculate MD5 checksums for multiple files:

# md5sum path/to/file1 path/to/filen2

3. Calculate a MD5 checksum from the standard input:

# echo "text" | md5sum

4. Read a file of MD5SUMs and verify all files have matching checksums:

# md5sum --check path/to/file.md5

5. Only show a message for missing files or when verification fails:

# md5sum --check --quiet path/to/file.md5

6. Only show a message for files for which verification fails, ignoring missing files:

# md5sum --ignore-missing --check --quiet path/to/file.md5

Filed Under: Linux

Some more articles you might also be interested in …

  1. Chezmoi: A multi-machine dotfile manager, written in Go
  2. setsid Command Examples in Linux
  3. “yum update” fails with “[package version 1] is a duplicate with [package version 2]”
  4. How to use Magic SysRq tool in CentOS / RHEL
  5. How to log every shell command in Linux
  6. Linux interview questions – Special permissions (SUID, SGID and sticky bit)
  7. How to use nomodeset to Troubleshoot Boot Issues
  8. CentOS / RHEL 7 : Lock User Account After N Number of Incorrect Login Attempts
  9. findmnt: command not found
  10. How to Disable Ctrl+c or Ctrl+z Using the “trap” Command in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • csslint: A linter for CSS code
  • csh: The shell (command interpreter) with C-like syntax (Command Examples)
  • csc: The Microsoft C# Compiler (Command Examples)
  • crystal: Tool for managing Crystal source code

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright