user3914897 user3914897 - 6 months ago 9
Bash Question

Is it possible to generate a checksum (md5 ) a string in a shell?

I would like to have a unique ID for filenames so I can iterate over the IDs and compare the checksums of the files?
Is it possible to have a checksum for the name of the file so I can have a unique ID per filename?
I would welcome other ideas.

Answer

Is it what you want?

Plain string:

serce@unit:~$ echo "Hello, checksum!" | md5sum
9f898618b071286a14d1937f9db13b8f  -

And file content:

serce@unit:~$ md5sum agent.yml
3ed53c48f073bd321339cd6a4c716c17  -