[Bash] Generate a UUID

Created on November 30, 2026

Run uuidgen to generate a UUID.

uuidgen

Example output

8d87f196-5aca-463a-af9a-0bd4bca349d2

Use command substitution to store the generated UUID in a shell variable. Each run generates a new value.

uuid=$(uuidgen)
echo "$uuid"
Bash