Reference

uuidgen(1)

generate universally unique identifiers

NAME

uuidgen – generate universally unique identifiers

SYNOPSIS

uuidgen [-1cr] [-n count] [-o filename]

DESCRIPTION

The uuidgen utility by default generates a single DCE version 1 universally unique identifier (UUID), also known as a globally unique identifier (GUID). The UUID is written to stdout by default. The following options can be used to change the behaviour of uuidgen:

-1

This option only has effect if multiple identifiers are to be generated and instructs uuidgen to not generate them in batch, but one at a time.

-c

This option controls creation of compact UUID (without hyphen).

-n

This option controls the number of identifiers generated. By default, multiple identifiers are generated in batch.

-o

Redirect output to filename instead of stdout.

-r

This option controls creation of random UUID (version 4).

Batched generation yields a dense set of identifiers in such a way that there is no identifier that is larger than the smallest identifier in the set and smaller than the largest identifier in the set and that is not already in the set.

When generating the identifiers one at a time, the identifiers will be close to each other, but operating system latency and processing time will be reflected in the distance between two successive identifiers.

EXIT STATUS

The uuidgen utility exits 0 on success, and >0 if an error occurs.

EXAMPLES

Generate a batch of three UUIDs. Notice the similarity of the string before the first hyphen of the UUID (known as time_low in rfc4122):

$ uuidgen -n3
8bc44345-4d90-11ee-88c7-b42e991fc52e
8bc44346-4d90-11ee-88c7-b42e991fc52e
8bc44347-4d90-11ee-88c7-b42e991fc52e

Generate a batch of random UUIDs without hyphens:

$ uuidgen -r -c -n3
5ad8b60a0f4e41f59c82d273202275f9
6c41925486cd4bf59720a5bad85de2e4
8144fdab63f648a1812d12453f975313

Notice that the UUIDs are not similar to each other.

SEE ALSO

uuidgen(2), uuid(3)

HISTORY

The uuidgen command first appeared in FreeBSD 5.0.

History

-c since FreeBSD 13.2-RELEASE; -o since FreeBSD 5.1-RELEASE; -r since FreeBSD 13.2-RELEASE.