Generate UUID in Bash

The easiest way to generate a random UUID version 4 in Bash is using a tool called uuidgen

 
uuidgen
#=> 4fdeff35-9e1e-4efa-a67c-a248d0043708
 

You can also generate versions 1, 3 and 5 with this tool, using the appropriate parameters:


# generate UUID version 1 - time based
uuidgen --time

# generate UUID version 3 - deterministic and hashed with MD5
uuidgen --name name --namespace `uuidgen` --md5

# generate UUID version 4 - random
uuidgen

# generate UUID version 5 - deterministic and hashed with SHA-1
uuidgen --name name --namespace `uuidgen` --sha1

How do I generate UUID in...

Find out how to generate UUIDs in your favorite language here: Groovy, Kotlin, Python, Scala, Clojure, ClojureScript, Java, JavaScript, or return to Online UUID Generator