random uuid
for random
Generate a random uuid string of the specified version.
Signature
> random uuid {flags}
Flags
--version, -v {int}
: The UUID version to generate (1, 3, 4, 5, 7). Defaults to 4 if not specified.--namespace, -n {string}
: The namespace for v3 and v5 UUIDs (dns, url, oid, x500). Required for v3 and v5.--name, -s {string}
: The name string for v3 and v5 UUIDs. Required for v3 and v5.--mac, -m {string}
: The MAC address (node ID) used to generate v1 UUIDs. Required for v1.
Input/output types:
input | output |
---|---|
nothing | string |
Examples
Generate a random uuid v4 string (default)
> random uuid
Generate a uuid v1 string (timestamp-based)
> random uuid -v 1 -m 00:11:22:33:44:55
Generate a uuid v3 string (namespace with MD5)
> random uuid -v 3 -n dns -s example.com
Generate a uuid v4 string (random).
> random uuid -v 4
Generate a uuid v5 string (namespace with SHA1)
> random uuid -v 5 -n dns -s example.com
Generate a uuid v7 string (timestamp + random)
> random uuid -v 7