uuidgen

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Command uuidgen creates and prints a new universally unique identifier (UUID).

It is a Go reimplementation of the util-linux uuidgen(1) command (see https://man7.org/linux/man-pages/man1/uuidgen.1.html), backed by the gofrs/uuid library instead of libuuid.

Usage:

uuidgen [options]

uuidgen can generate three families of UUID:

  • Random-based UUIDs (version 4), generated with cryptographically strong random bits. This is the default.
  • Time-based UUIDs (versions 1, 6, and 7), derived from the system clock. Versions 6 and 7 are lexicographically sortable by creation time; version 1 is not.
  • Hash-based UUIDs (versions 3 and 5), computed by hashing a namespace UUID concatenated with a name, using MD5 or SHA-1 respectively.

Options:

-r, --random           generate a random-based UUID (version 4) [default]
-t, --time              generate a time-based UUID (version 1)
-6, --time-v6           generate a sortable time-based UUID (version 6)
-7, --time-v7           generate a sortable time-based UUID (version 7)
-m, --md5               generate a name-based UUID using MD5 (version 3);
                        requires --namespace and --name
-s, --sha1              generate a name-based UUID using SHA-1 (version 5);
                        requires --namespace and --name
-n, --namespace NS      namespace UUID for --md5/--sha1, either a literal
                        UUID or one of the well-known aliases @dns, @url,
                        @oid, @x500
-N, --name NAME         name value to hash with the namespace
-x, --hex               interpret NAME as a hexadecimal string
-C, --count NUM         generate NUM UUIDs instead of one (default 1)
-h, --help              display this help and exit
-V, --version           output version information and exit

Examples:

uuidgen
uuidgen --time
uuidgen --sha1 --namespace @dns --name www.example.com
uuidgen --count 5

Each generated UUID is printed on its own line in canonical 8-4-4-4-12 hexadecimal form.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL