How to generate a uuid in shell script
Have you tried
uuidgen
It's installed out-of-the-box on freeBSD systems like MacOS.
On Fedora, CentOS, and RHEL, get it from the util-linux
package (CentOS6 has it in util-linux-ng
). On debian, get it with sudo apt-get install uuid-runtime
. On other linux systems, try looking for the e2fsprogs
package.
From this rather comprehensive article.
http://0pointer.de/blog/projects/ids.html
(btw, that's the blog of Lennart Poettering)
Linux offers a kernel interface to generate UUIDs on demand, by reading from /proc/sys/kernel/random/uuid
This is a very simple interface to generate UUIDs. That said, the logic behind UUIDs is unnecessarily complex and often it is a better choice to simply read 16 bytes or so from /dev/urandom