EN
Bash - calculate md5 sum in terminal
5
points
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:
1cb251ec0d568de6a929b520c4aed8d1
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