UUIDs is very helpful to known as identifier for block devices in Linux and its represented by 32 hexadecimal digits probably 128 bit long numbers.
On this post can generate UUID in three types of command line,
uuidd
uuid
uuidgen
uuidd
Before generate UUID need to execute the below command and check your process status,
# uuidd -p /tmp/uuidd.pid -s /tmp/uuidd.socket
# ps aux | grep uuidd
# ps aux | grep uuidd
libuuid 28003 0.0 0.0 3376 308 ? Ss 18:24 0:00 uuidd -p /tmp/uuidd.pid -s /tmp/uuidd.socket
also see the process id (PID)
# cat /tmp/uuidd.pid
28003
Generate UUID maximum 5 ID's
# uuidd -d -r -n 5 -s /tmp/uuidd.socket
List of UUIDs:
a9fc32f6-d3cb-4534-984d-aad10f9f53da
3f88d69c-4d7f-40ed-aea0-3a6f7611cf92
358f2637-b906-48f7-abe5-e796b04e574f
c2e1770e-8490-4f2b-861c-dfd63582342e
c0796a9a-7b5b-4e3b-a67c-6e96d57439d5
To terminate the uuidd process, if you unable to get it can kill the process directly,
# uuidd -d -s -k /tmp/uuidd.socket
# kill -9 28003
# kill -9 28003
uuidgen
# uuidgen
c41b33a2-471c-4048-a1e3-8b2dc1a761d8
# for i in `seq 1 5`; do uuidgen; done
431139f6-4fb3-4487-88cc-89610eb946ac
cc878f94-523f-4544-b15a-ea4a580b08a2
e7ec8f7e-95bf-43e3-bf46-60baecde412e
bd3f6ecf-8cd0-4d9e-b8cd-c0ac81426321
86b97bc7-73e1-44e7-ac65-bfae84d3ff6b
Generate time-based uuid
# for i in `seq 1 5`; do uuidgen -t; done
9e55f162-4000-11e4-b963-50b7c35a1e6e
9e566048-4000-11e4-b963-50b7c35a1e6e
9e56d46a-4000-11e4-b963-50b7c35a1e6e
9e57438c-4000-11e4-b963-50b7c35a1e6e
9e57b11e-4000-11e4-b963-50b7c35a1e6e
Generate random-based uuid
# for i in `seq 1 5`; do uuidgen -r; done
fb8ce6f4-9e6f-4e32-8088-403720fd71a4
81ec8466-e4f0-47e9-b115-fad439b03363
83b90068-12bf-483a-995e-6938f8df380b
f4f1ba13-6f31-4c04-a168-eb3ac59b8f59
8b0b81ca-61f1-41df-867b-7cfe74f99d71
For more help,
# uuidgen -h
Usage:
uuidgen [options]
Options:
-r, --random generate random-based uuid
-t, --time generate time-based uuid
-V, --version output version information and exit
-h, --help display this help and exit
uuid
# apt-get install uuid
# uuid
# uuid
99cde402-3fff-11e4-a7c6-50b7c3745b84
# uuid -n 5
dfeeb2ba-4002-11e4-824d-50b7c3745b84
dfeeb6ca-4002-11e4-824e-50b7c3745b84
dfeeb80a-4002-11e4-824f-50b7c3745b84
dfeeb90e-4002-11e4-8250-50b7c3745b84
dfeeba80-4002-11e4-8251-50b7c3745b84
By normally generate the UUID random from the below path,
# cat /proc/sys/kernel/random/uuid
61a0d834-e8c1-4e73-acc7-255d5086e576
python:
# python -c 'import uuid; print uuid.uuid1()'
49270506-3fff-11e4-b963-50b7c35a1e6e
Comments (0)