{"id":20537,"date":"2023-08-31T15:47:41","date_gmt":"2023-08-31T15:47:41","guid":{"rendered":"https:\/\/linuxways.net\/?p=20537"},"modified":"2023-08-31T15:47:41","modified_gmt":"2023-08-31T15:47:41","slug":"how-to-install-and-use-uuidgen-in-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/best-of-linux\/how-to-install-and-use-uuidgen-in-debian-12\/","title":{"rendered":"How to Install and Use UUIDgen in Debian 12"},"content":{"rendered":"<p><strong>Debian <\/strong>is an operating system that provides multiple packages such as \u201cdbus-bin\u201d, \u201cuuid-runtime\u201d, etc. to perform different tasks. <strong>UUID <\/strong>is an abbreviation for Universally Unique Identifiers. UUIDs are quite powerful and can be used to create useful data on the command line interface with shell scripting.<\/p>\n<p>This article will demonstrate the installation and usage of UUIDgen in Debian 12.<\/p>\n<h2><strong>What is UUIDgen? <\/strong><\/h2>\n<p>To create Universally Unique Identifiers, we use a tool known as <strong>UUIDgen<\/strong>. UUIDgen is a convenient tool for programmers and administrators. It helps to identify our resources uniquely. The UUIDgen tool generates a new universally unique identifier with the help of the \u201clibuuid library\u201d.<\/p>\n<h2><strong>How to Install UUIDgen in Debian 12?<\/strong><\/h2>\n<p>To install the UUID runtime package, simply use the command given below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> uuid-runtime<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"377\" class=\"wp-image-20538\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-1.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-1-300x120.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-1-768x308.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/strong><\/p>\n<p>After installing the \u201cuuid-runtime\u201d package, a single UUID user can be generated using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">uuidgen<\/span><\/div><\/div>\n<p>The following output will be displayed with a different UUID:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"42\" class=\"wp-image-20539\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-2.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-2-300x13.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-2-768x34.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/strong><\/p>\n<p>To create time-based UUIDs, use the \u201cuuidgen -t\u201d command as shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">uuidgen<\/span> <span class=\"re5\">-t<\/span><\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"51\" class=\"wp-image-20540\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-3.png 413w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-3-300x37.png 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/strong><\/p>\n<p>To generate a random UUID use \u201c<strong>-r<\/strong>\u201d along with \u201cuuidgen\u201d using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">uuidgen<\/span> <span class=\"re5\">-r<\/span><\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"37\" class=\"wp-image-20541\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-4.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-4-300x12.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-4-768x30.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/strong><\/p>\n<h2><strong>How to Generate Multiple UUIDs?<\/strong><\/h2>\n<p>To create a list of UUIDs at once, we will shell scripting using a for loop. To retrieve a list of 10 UUIDs use the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw1\">for<\/span> i <span class=\"kw1\">in<\/span> <span class=\"br0\">&#123;<\/span><span class=\"nu0\">1<\/span>..<span class=\"nu0\">10<\/span><span class=\"br0\">&#125;<\/span>; <span class=\"kw1\">do<\/span> <span class=\"kw2\">uuidgen<\/span>; <span class=\"kw1\">done<\/span><\/div><\/div>\n<p>We can see that 10 UUIDs are displayed on the screen as shown below:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"186\" class=\"wp-image-20542\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-5.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-5-300x59.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-5-768x152.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/strong><\/p>\n<h2><strong>How to Use UUIDs in Test Data?<\/strong><\/h2>\n<p>To display a list of comma-separated values (CSV) along with Two UUIDs per line, we use the echo command with a \u201cfor loop\u201d. Execute the command shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw1\">for<\/span> i <span class=\"kw1\">in<\/span> <span class=\"br0\">&#123;<\/span><span class=\"nu0\">1<\/span>..<span class=\"nu0\">10<\/span><span class=\"br0\">&#125;<\/span>; <span class=\"kw1\">do<\/span> <span class=\"kw3\">echo<\/span> <span class=\"sy0\">`<\/span><span class=\"kw2\">uuidgen<\/span><span class=\"sy0\">`<\/span>,<span class=\"sy0\">`<\/span><span class=\"kw2\">uuidgen<\/span><span class=\"sy0\">`<\/span>; <span class=\"kw1\">done<\/span><\/div><\/div>\n<p>This will create a CSV with two UUIDs per line:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"187\" class=\"wp-image-20543\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-6.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-6-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-6-768x153.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/strong><\/p>\n<p>Similarly, we can create data with email addresses by using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw1\">for<\/span> i <span class=\"kw1\">in<\/span> <span class=\"br0\">&#123;<\/span><span class=\"nu0\">1<\/span>..<span class=\"nu0\">10<\/span><span class=\"br0\">&#125;<\/span>; <span class=\"kw1\">do<\/span> <span class=\"kw3\">echo<\/span> <span class=\"sy0\">`<\/span><span class=\"kw2\">uuidgen<\/span><span class=\"sy0\">`@`<\/span><span class=\"kw2\">uuidgen<\/span><span class=\"sy0\">`<\/span>.com; <span class=\"kw1\">done<\/span><\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"190\" class=\"wp-image-20544\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-7.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-7-300x61.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-7-768x155.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/strong><\/p>\n<p>These aren\u2019t real email addresses, but we can change the above command a bit and replace the second uuidgen with an email address domain like \u201cjunkfilter.com\u201d as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"359\" class=\"wp-image-20545\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-8.png 761w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/08\/word-image-20537-8-300x142.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>UUIDs are quite powerful. To install UUID in Debian 12, use the \u201c<strong>sudo apt install uuid-runtime<\/strong>\u201d command. To generate a single user use the \u201c<strong>UUIDgen<\/strong>\u201d command. We can create hash-based and time-based UUIDs using the \u201cuuidgen -t\u201d and \u201cuuidgen -r\u201d commands. We can also create data like email addresses using the \u201c<strong>for i in {1..10}; do echo `uuidgen`, `uuidgen`; done<\/strong>\u201d command. This write-up has depicted how to install and use UUIDgen in Debian 12.<\/p>","protected":false},"excerpt":{"rendered":"<p>To install UUID in Debian 12, use the \u201csudo apt install uuid-runtime\u201d command. To generate a single user use the \u201cUUIDgen\u201d command.<\/p>","protected":false},"author":110,"featured_media":20546,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1053],"tags":[],"class_list":["post-20537","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-of-linux"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/20537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=20537"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/20537\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/20546"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=20537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=20537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=20537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}