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 with X. so like, the X-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 ($TMP on 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, but mktemp creates 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 and TMPDIR (TMP on 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