How it works...

The mktemp command is straightforward. It generates a file with a unique name and returns its filename (or directory name, in the case of directories).

When providing custom templates, X will be replaced by a random alphanumeric character. Also note that there must be at least three X characters in the template for mktemp to work.