Generate Random String

Every once in a while a “unique” string is needed, to set a hostname, test run ID, … UUID would of course be sure way to do this, but sometimes that’s not available and you just want it to be reasonbly unique. Here’s a short way to accomplish that - 16 random characters.

tr -dc A-Z-a-z-0-9 < /dev/urandom | head -c16
This work by Fredrik Wendt is licensed under CC by-sa.