Generate UUID using uuidgen on Raspberry Pi

Generate UUID using uuidgen on Raspberry Pi

UUID (Universally Unique Identifier) is a 128-bit number which mostly represented as a hexadecimal string. It can be used for uniquely identifying objects across a network. The uuidgen is a command line tool that allows to generate UUID.

This tutorial explains how to install and use uuidgen on Raspberry Pi.

Install uuidgen

Connect to Raspberry Pi via SSH. The uuidgen is available in uuid-runtime package. So update the package lists and install uuidgen by using the following commands:

sudo apt update
sudo apt install -y uuid-runtime

Once installed, we can check version of uuidgen:

uuidgen --version

Testing uuidgen

There are several versions of UUIDs. UUID Version 1 is based on time and MAC address. It can be generated with -t option along with uuidgen command.

uuidgen -t

Output will be similar to this:

60857a70-b06e-11eb-870c-b827ebd478a2

UUID Version 4 is randomly generated. Run the uuidgen command without any arguments to generate it:

uuidgen

UUID Version 4 also can generated with -r option.

uuidgen -r

Uninstall uuidgen

Run the following command if you want to completely remove uuidgen and related dependencies:

sudo apt purge --autoremove -y uuid-runtime

Leave a Comment

Cancel reply

Your email address will not be published.