MKTEMP(1)
π hey bestie, welcome to mktemp(1) π
okay so this is the General Commands Manual page for mktemp, section 1, and honestly? it's a little icon. it makes temporary files and directories for you so you don't have to hand-roll sketchy filename guessing. let's get into it, no cap π«Ά
β¨ NAME β¨
mktemp β Create a temporary file or directory. that's it, that's the whole job, and it does it flawlessly π
πΈ SYNOPSIS πΈ
mktemp [OPTION]... [TEMPLATE]
π¦ DESCRIPTION π¦
Create a temporary file or directory.
like, literally. you run it, it hands you a fresh name that nobody else is using, and it does the creating for you. main character behaviour, tbh π
π OPTIONS π
-d,--directoryβ Make a directory instead of a file. yes queen, a whole folder π-u,--dry-runβ do not create anything; merely print a name (unsafe). okay so listen: this one is giving chaos. it doesn't actually make the thing, it just whispers a name at you, and that name could absolutely get snatched by somebody else in the meantime. unsafe. fr fr π-q,--quietβ Fail silently if an error occurs. no drama, no output, it justβ¦ doesn't work and says nothing π--suffix <SUFFIX>β append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. also, this option is implied if TEMPLATE does not end withX. so like, theX-ending thing is the whole vibe basically π-p <DIR>β short form of--tmpdir. the little nickname version π«Ά--tmpdir[=<DIR>]β interpret TEMPLATE relative to DIR; if DIR is not specified, use$TMPDIR($TMPon windows) if set, else/tmp. important deets: with this option, TEMPLATE must not be an absolute name; and unlike with-t, TEMPLATE may contain slashes, butmktempcreates only the final component. so it's flexible but it's not gonna go build a whole directory tree for you, bestie π-tβ Generate a template (using the supplied prefix andTMPDIR(TMPon windows) if set) to create a filename template [deprecated]. deprecated, babes. it still works but it's giving π΅ iykyk-h,--helpβ Print help. your little cheat sheet π-V,--versionβ Print version. flex the number π[template]β the optional template argument, right there at the end of the list, exactly where they left it β¨
π₯ VERSION π₯
v(uutils coreutils) 0.12.0
π EXAMPLES π
Create an empty temporary file and print its absolute path:
mktemp
Use a custom directory if $TMPDIR is not set (the default is platform-dependent, but usually /tmp):
mktemp -p /path/to/temporary_directory
Use a custom path template (Xs are replaced with random alphanumeric characters):
mktemp /tmp/example.XXXXXXXX
Use a custom file name template:
mktemp -t example.XXXXXXXX
Create an empty temporary directory and print its absolute path:
mktemp -d
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail.
so yes, credit where credit is due: tldr-pages, CC BY 4.0, and a lil heads up that uutils is still cooking so some of these might not land perfectly yet π
and that's the page, bestie π this one's dated 2026-09-25 and it's the MKTEMP(1) page from the General Commands Manual. go forth and make temp files responsibly, ily, bye π§β¨
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms