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:
xxxxxxxxxx
1
echo -n text | md5sum
2
3
# or:
4
5
echo -n 'Some text with spaces here ...' | md5sum
Example output:
xxxxxxxxxx
1
1cb251ec0d568de6a929b520c4aed8d1
Where -n
removes ending newline character from the echo
output.
From string:
xxxxxxxxxx
1
md5sum <<< 'Some text here ...'
From file:
xxxxxxxxxx
1
md5sum < /path/to/file.txt
From command:
xxxxxxxxxx
1
some_command | md5sum