Generate UUID using uuidgen on Ubuntu 22.04

Generate UUID using uuidgen on Ubuntu 22.04

UUID (Universally Unique Identifier) is a 128-bit number that often represented as a hexadecimal string. It can be used for uniquely identifying objects. The uuidgen is a command line tool for generating UUID. This tutorial shows how to install and use uuidgen on Ubuntu 22.04.

Install uuidgen

Update the package lists:

sudo apt update

The uuidgen is available in uuid-runtime package. Install it using the following command:

sudo apt install -y uuid-runtime

We can check uuidgen version:

uuidgen --version

Testing uuidgen

There are several versions of UUIDs. UUID Version 1 is based on time and MAC address. To generate it, use -t option:

uuidgen -t

Output example:

22ebab0a-28cf-11ed-aca8-613a5bf43b26

UUID Version 4 can be generated with -r option:

uuidgen -r

Uninstall uuidgen

To completely remove uuidgen, run the following command:

sudo apt purge --autoremove -y uuid-runtime

Leave a Comment

Cancel reply

Your email address will not be published.