Random UUID is great when you need to generate a file with a temporary filename and avoiding file naming conflict.
Bash
No additional installation required for Bash, just run the command below.
uuidgen
Ruby
No additional installation required for Ruby too. Just copy the codes below into “uuid.rb”.
require 'securerandom'
puts SecureRandom.uuid
Use the command below to execute the Ruby script.
ruby uuid.rb
Go/Golang
The component to generate UUID does not come preinstalled together with the standard installation of Go/Golang. You’ll need to install the package by running the command below.
go get github.com/google/uuid
Paste the content below into “uuid.go”.
package mainimport (
"fmt"
"github.com/google/uuid"
)func main(){
fmt.Println(uuid.New())
}
Use command below to run it.
go run uuid.go