MKTEMP(1)
๐ MKTEMP(1) โ the girliepop guide to making temp files ๐
okay so bestie, welcome to mktemp(1), straight out of the User Commands section. this is the one that makes you a temporary file or a temporary directory safely and then yells the name back at you so you can actually use it. no cap. โจ
โจ NAME โจ
mktemp โ create a temporary file or directory ๐
๐ธ SYNOPSIS ๐ธ
mktemp [OPTION]... [TEMPLATE]
๐ฆ DESCRIPTION ๐ฆ
okay so the whole vibe is this: you want a temp file or dir, you want it made safely, and you want the name printed out so you can go do your little thing with it. that's it, that's the whole job. ๐
your TEMPLATE has to have at least 3 consecutive Xs in the last component. that's the whole rule, don't fight it. and if you don't pass a TEMPLATE at all? no stress, it just uses tmp.XXXXXXXXXX, and --tmpdir gets implied for you. so thoughtful. ๐ซถ
and listen, the perms are specific: files get created u+rw, and directories get u+rwx, and then umask restrictions get subtracted from all that. periodt.
here's the full option menu, bestie, and yes we're going through every single one:
-d,--directoryโ make a directory, not a file. that's it. that's the whole thing. ๐-u,--dry-runโ don't create anything at all, just print a name. and ngl, this one is unsafe, the manpage literally says so, so likeโฆ be aware. ๐-q,--quietโ shuts up the diagnostics when file/dir creation fails. silent but deadly. ๐--suffix=SUFFโ sticksSUFFonto the end of yourTEMPLATE. important:SUFFmust not contain a slash. also this option gets implied automatically if yourTEMPLATEdoesn't end inX. ๐-p DIR,--tmpdir[=DIR]โ reads yourTEMPLATEas relative toDIR. if you don't give aDIR, it uses$TMPDIRif that's set, otherwise/tmp. and here's the tea: with this option yourTEMPLATEmust not be an absolute name, and unlike with-t, yourTEMPLATEis allowed to contain slashes โ butmktemponly ever creates the final component. just the last one. don't get it twisted. ๐ง-tโ readsTEMPLATEas a single file name component, relative to a directory:$TMPDIRif it's set; otherwise the directory you gave via-p; otherwise/tmp. and bestieโฆ this one is[deprecated]. it's giving legacy energy. it still works but like, iykyk. โญ--helpโ displays this help and dips. ๐--versionโ outputs version info and dips. ๐
โ ๏ธ real talk:-u/--dry-runis flagged unsafe right there in the source material, and-tis flagged deprecated. i'm not adding lore, i'm just repeating the warning label. take it seriously. ๐ฅ
๐ AUTHOR ๐
Written by Jim Meyering and Eric Blake. absolute icons, honestly. ๐
๐ญ REPORTING BUGS ๐ญ
found something cursed? tell the girlies:
- Report bugs to: <bug-coreutils@gnu.org>.
- Report any translation bugs to: <https://translationproject.org/team/>.
- GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
- General help using GNU software: <https://www.gnu.org/gethelp/>
๐ COPYRIGHT ๐
Copyright ยฉ 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
not me being legally obligated to say there's no warranty. there's no warranty bestie. to the extent permitted by law. ๐ซถ
๐ SEE ALSO ๐
Full documentation <https://www.gnu.org/software/coreutils/mktemp>
or available locally via: info '(coreutils) mktemp invocation'
and that's the whole page, bestie!! this was GNU coreutils 9.12, dated September 2026, and you read it all the way to the end which is genuinely iconic of you. go make a temp file. slay. ๐ โจ๐
๐ฆ where this page comes from
- arch rolling: coreutils 9.12-2 ยท GPL-3.0-or-later AND GFDL-1.3-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms