Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux command to generate new GUID?

Tags:

linux

guid

Sometimes in bash scripting, i need to generate new GUID(Global Unique Identifier).

I already done that by a simple python script that generates a new guid: see here

#! /usr/bin/env python
import uuid
print str(uuid.uuid1())

But i need to copy this script into any new system that i works on.

My question is: can anybody introduce a command or package that contains similar command ?

like image 897
pylover Avatar asked May 04 '13 08:05

pylover


People also ask

How do I generate a new GUID?

Open Visual Studio->Tools->Create GUID->Registry Format->New GUID. It will create a new GUID every time you click New GUID.

How do I get a unique GUID?

To Generate a GUID in Windows 10 with PowerShell, Type or copy-paste the following command: [guid]::NewGuid() . This will produce a new GUID in the output. Alternatively, you can run the command '{'+[guid]::NewGuid(). ToString()+'}' to get a new GUID in the traditional Registry format.

How does Linux generate UUID?

To generate a single UUID, run the uuidgen command without any arguments. Out of the box, uuidgen will generate a random UUID each time it runs. Execute the following command in your terminal: uuidgen.

Does Linux have a GUID?

Permissions are a crucial part of Linux. The chmod command is typically used to set and modify simple permissions. However, there are special permissions that one can set using the chmod command as well. These special permissions are known as SUID, GUID, and sticky bit.


1 Answers

Assuming you don't have uuidgen, you don't need a script:

$ python -c 'import uuid; print(str(uuid.uuid4()))'
b7fedc9e-7f96-11e3-b431-f0def1223c18
like image 156
MikeyB Avatar answered Nov 10 '22 00:11

MikeyB