LinuxCommandLibrary

uuidparse

Parse and validate UUID strings

TLDR

Parse the specified UUIDs, use a tabular output format

$ uuidparse [uuid1 uuid2 ...]
copy

Parse UUIDs from stdin
$ [command] | uuidparse
copy

Use the JSON output format
$ uuidparse [[-J|--json]] [uuid1 uuid2 ...]
copy

Do not print a header line
$ uuidparse [[-n|--noheadings]] [uuid1 uuid2 ...]
copy

Use the raw output format
$ uuidparse [[-r|--raw]] [uuid1 uuid2 ...]
copy

Specify which of the four output columns to print
$ uuidparse [[-o|--output]] [UUID,VARIANT,TYPE,TIME]
copy

Display help
$ uuidparse [[-h|--help]]
copy

SYNOPSIS

N/A - The command 'uuidparse' is not a standard standalone utility.

To parse a UUID, one typically uses scripting, programming libraries, or standard text processing tools (e.g.,
echo "<UUID>" | awk -F'-' '{print $1}').

DESCRIPTION

The command 'uuidparse' is not a standard, standalone utility found in most common Linux distributions. The functionality of parsing a Universally Unique Identifier (UUID) – which involves breaking down its 128-bit structure into components like timestamp, version, clock sequence, and node ID – is typically achieved through other means.

Developers often use programming libraries, such as 'libuuid' (a part of the 'util-linux' project), which provides the 'uuid_parse()' function in C. For shell users, UUIDs are usually treated as opaque strings, and specific components are extracted using standard text processing tools like 'grep', 'sed', 'awk', or 'cut' based on the UUID's well-defined hexadecimal format. Commands like 'blkid' and 'lsblk' display UUIDs associated with filesystems or block devices, but they do not provide options for internal parsing of the UUID string itself.

CAVEATS

The command uuidparse does not exist as a standard, standalone utility in most common Linux distributions.
Its functionality, which would involve breaking down a UUID string into its components (e.g., time, version, clock sequence, node ID), is typically handled by:

1.
Programming libraries such as libuuid (part of the util-linux project), which provides the uuid_parse() function.

2.
Shell scripting with tools like grep, sed, awk, or cut to extract specific parts based on the UUID format.

3.
Other utilities like blkid or lsblk which display UUIDs but do not offer options to parse their internal structure.

<I>UUID STRUCTURE OVERVIEW</I>

A Universally Unique Identifier (UUID) is a 128-bit number used to uniquely identify information. It is typically represented as 32 hexadecimal digits, displayed in 5 groups separated by hyphens, in the format 8-4-4-4-12 (e.g., aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee).
Different versions of UUIDs (e.g., Version 1 based on time and MAC address, Version 4 based on random numbers) have specific bit layouts for their components.

<I>COMMON SHELL PARSING EXAMPLES</I>

Although no direct uuidparse command exists, shell commands can extract parts of a UUID string.
For example, to get the first part (time_low for Version 1/4):
UUID="123e4567-e89b-12d3-a456-426655440000"
echo $UUID | cut -d'-' -f1


To extract the version number (the first digit of the third group):
echo $UUID | cut -d'-' -f3 | cut -c1
More complex parsing might require regular expressions with grep -oP or scripting languages like Python or Perl.

HISTORY

While there isn't a dedicated 'uuidparse' command, the concept of UUID parsing is integral to systems managing unique identifiers.
The underlying C library, libuuid, which provides the uuid_parse() function, has been a part of the util-linux project for a long time, enabling applications to work with UUIDs consistently across Linux systems.
The library handles various UUID versions (1, 3, 4, 5) and their specific parsing requirements.

SEE ALSO

uuidgen(1), blkid(8), lsblk(8), libuuid(3)

Copied to clipboard