LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

uuidgen

Generate new UUID values

TLDR

Generate a random UUID (v4)
$ uuidgen -r
copy
Generate a time-based UUID (v1)
$ uuidgen -t
copy
Generate a time-based sortable UUID (v7)
$ uuidgen -7
copy
Generate a SHA1-based UUID (v5) from a namespace and name
$ uuidgen -s -n @dns -N [example.com]
copy
Generate a MD5-based UUID (v3) from a namespace and name
$ uuidgen -m -n @url -N [https://example.com]
copy
Generate multiple time-based UUIDs at once
$ uuidgen -t -C [5]
copy

SYNOPSIS

uuidgen [options]

DESCRIPTION

uuidgen creates a new universally unique identifier (UUID). By default it generates a random UUID (version 4). Time-based (v1) UUIDs include timestamp and MAC address. Name-based UUIDs (v3/v5) are deterministic, generating the same UUID for the same namespace and name combination.UUIDs are 128-bit identifiers commonly used for unique identification in databases, distributed systems, and file systems.

PARAMETERS

-r, --random

Generate random UUID (version 4)
-t, --time
Generate time-based UUID (version 1)
-7, --time-v7
Generate time-based UUID (version 7), lexicographically sortable by timestamp
-s, --sha1
Generate SHA1-based UUID (version 5)
-m, --md5
Generate MD5-based UUID (version 3)
-n, --namespace _ns_
Namespace for name-based UUIDs (@dns, @url, @oid, @x500)
-N, --name _name_
Name for name-based UUIDs
-x, --hex
Interpret name as a hexadecimal string
-C, --count _num_
Generate multiple UUIDs
-h, --help
Display help text and exit
-V, --version
Print version and exit

UUID VERSIONS

v1: Time and MAC address basedv3: MD5 hash of namespace and namev4: Randomv5: SHA1 hash of namespace and namev7: Time-based, lexicographically sortable (RFC 9562)

CAVEATS

Time-based UUIDs expose the MAC address of the generating machine. For privacy, prefer random UUIDs. Part of the util-linux package.

SEE ALSO

uuid(1)

Copied to clipboard
Kai