mktemp -- make temporary file name (unique)


mktemp [-q] [-u] template


The mktemp command takes the given file name template and overwrites a portion of it to create a file name. This file name shall be unique and suitable for use by the application.

The template should have at least six trailing 'X' characters. These characters are replaced with characters from the portable filename character set in order to generate a unique name.

If mktemp can successfully generate a unique file name, and the -u option is not present, the file shall be created with read and write permission only for the current user. The mktemp command shall write the filename generated to the standard output.



fail silently if an error occurs. Diagnostic messages to stderr are suppressed, but the command shall still exit with a non-zero exit status if an error occurs.


operates in `unsafe' mode. A unique name is generated, but the temporary file shall be unlinked before mktemp exits. Use of this option is not encouraged.