Bash - calculate md5 sum in terminal

5 points
Created by:

In this short article, we would like to show how to calculate md5 sum in Bash for a given string.

Quick solution:

echo -n text | md5sum

# or:

echo -n 'Some text with spaces here ...' | md5sum

Example output:


Where -n removes ending newline character from the echo output.


Alternative examples

From string:

md5sum <<< 'Some text here ...'

From file:

md5sum < /path/to/file.txt

From command:

some_command | md5sum


Alternative titles

  1. Bash - calculate md5 hash in terminal
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.


Bash - calculate md5 sum in terminal
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂