Generate an UUID in bash

It’s as easy as running uuidgen:

uuid=$(uuidgen)
echo $uuid

It’s part of uuid-runtime on Debian. On OS X, it seems to be built-in.

If uuidgen is not available for some reason, the same can be achieved with Python:

python  -c 'import uuid; print uuid.uuid1()'