← 返回命令列表

Linux command

uuidgen 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate

uuidgen -r

Generate

uuidgen -t

Generate

uuidgen -7

Generate

uuidgen -s -n @dns -N [example.com]

Generate

uuidgen -m -n @url -N [https://example.com]

Generate

uuidgen -t -C [5]

说明

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.

参数

-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

FAQ

What is the uuidgen command used for?

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.

How do I run a basic uuidgen example?

Run `uuidgen -r` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -r, --random do in uuidgen?

Generate random UUID (version 4)