{
    "content": [
        {
            "type": "text",
            "text": "# mktemp(1) (man)\n\n## TLDR\n\n> Create a temporary file or directory.\n\n- Create an empty temporary file and print its absolute path:\n  `mktemp`\n- Use a custom directory if `$TMPDIR` is not set (the default is platform-dependent, but usually `/tmp`):\n  `mktemp -p /{{path/to/temporary_directory}}`\n- Use a custom path template (`X`s are replaced with random alphanumeric characters):\n  `mktemp {{/tmp/example.XXXXXXXX}}`\n- Use a custom file name template:\n  `mktemp -t {{example.XXXXXXXX}}`\n- Create an empty temporary directory and print its absolute path:\n  `mktemp -d`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** mktemp - create a temporary file or directory\n\n**Synopsis:** mktemp [OPTION]... [TEMPLATE]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -d | --directory | — | create a directory, not a file |\n| -u | --dry-run | — | do not create anything; merely print a name (unsafe) |\n| -q | --quiet | — | suppress diagnostics about file/dir-creation failure --suffix=SUFF append SUFF to TEMPLATE; SUFF must not contain a slas |\n| -p | --tmpdir | — | interpret TEMPLATE relative to DIR; if DIR is not specified, use $TMPDIR if set, else /tmp. With this option, TEMPLATE m |\n| -t | — | — | if set; else the directory specified via -p; else /tmp [deprecated] --help display this help and exit |\n| — | --version | — | output version information and exit |\n\n## See Also\n\n- mkstemp(3)\n- mkdtemp(3)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (5 lines) — 6 subsections\n  - -d --directory (2 lines)\n  - -u --dry-run (2 lines)\n  - -q --quiet (6 lines)\n  - -p --tmpdir (4 lines)\n  - -t (4 lines)\n  - --version (2 lines)\n- **AUTHOR** (2 lines)\n- **REPORTING BUGS** (3 lines)\n- **COPYRIGHT** (5 lines)\n- **SEE ALSO** (8 lines)\n\n## Full Content\n\n### NAME\n\nmktemp - create a temporary file or directory\n\n### SYNOPSIS\n\nmktemp [OPTION]... [TEMPLATE]\n\n### DESCRIPTION\n\nCreate  a  temporary file or directory, safely, and print its name.  TEMPLATE must contain at\nleast  3  consecutive  'X's  in  last  component.   If  TEMPLATE  is   not   specified,   use\ntmp.XXXXXXXXXX,  and --tmpdir is implied.  Files are created u+rw, and directories u+rwx, mi‐\nnus umask restrictions.\n\n#### -d --directory\n\ncreate a directory, not a file\n\n#### -u --dry-run\n\ndo not create anything; merely print a name (unsafe)\n\n#### -q --quiet\n\nsuppress diagnostics about file/dir-creation failure\n\n--suffix=SUFF\nappend SUFF to TEMPLATE; SUFF must not contain a slash.  This  option  is  implied  if\nTEMPLATE does not end in X\n\n#### -p --tmpdir\n\ninterpret  TEMPLATE relative to DIR; if DIR is not specified, use $TMPDIR if set, else\n/tmp.  With this option, TEMPLATE must not be an absolute name; unlike with  -t,  TEM‐\nPLATE may contain slashes, but mktemp creates only the final component\n\n#### -t\n\nif set; else the directory specified via -p; else /tmp [deprecated]\n\n--help display this help and exit\n\n#### --version\n\noutput version information and exit\n\n### AUTHOR\n\nWritten by Jim Meyering and Eric Blake.\n\n### REPORTING BUGS\n\nGNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n\n### COPYRIGHT\n\nCopyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3  or  later\n<https://gnu.org/licenses/gpl.html>.\nThis  is free software: you are free to change and redistribute it.  There is NO WARRANTY, to\nthe extent permitted by law.\n\n### SEE ALSO\n\nmkstemp(3), mkdtemp(3), mktemp(3)\n\nFull documentation <https://www.gnu.org/software/coreutils/mktemp>\nor available locally via: info '(coreutils) mktemp invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                   MKTEMP(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "mktemp",
        "section": "1",
        "mode": "man",
        "summary": "mktemp - create a temporary file or directory",
        "synopsis": "mktemp [OPTION]... [TEMPLATE]",
        "tldr_summary": "Create a temporary file or directory.",
        "tldr_examples": [
            {
                "description": "Create an empty temporary file and print its absolute path",
                "command": "mktemp"
            },
            {
                "description": "Use a custom directory if `$TMPDIR` is not set (the default is platform-dependent, but usually `/tmp`)",
                "command": "mktemp -p /{{path/to/temporary_directory}}"
            },
            {
                "description": "Use a custom path template (`X`s are replaced with random alphanumeric characters)",
                "command": "mktemp {{/tmp/example.XXXXXXXX}}"
            },
            {
                "description": "Use a custom file name template",
                "command": "mktemp -t {{example.XXXXXXXX}}"
            },
            {
                "description": "Create an empty temporary directory and print its absolute path",
                "command": "mktemp -d"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-d",
                "long": "--directory",
                "arg": null,
                "description": "create a directory, not a file"
            },
            {
                "flag": "-u",
                "long": "--dry-run",
                "arg": null,
                "description": "do not create anything; merely print a name (unsafe)"
            },
            {
                "flag": "-q",
                "long": "--quiet",
                "arg": null,
                "description": "suppress diagnostics about file/dir-creation failure --suffix=SUFF append SUFF to TEMPLATE; SUFF must not contain a slash. This option is implied if TEMPLATE does not end in X"
            },
            {
                "flag": "-p",
                "long": "--tmpdir",
                "arg": null,
                "description": "interpret TEMPLATE relative to DIR; if DIR is not specified, use $TMPDIR if set, else /tmp. With this option, TEMPLATE must not be an absolute name; unlike with -t, TEM‐ PLATE may contain slashes, but mktemp creates only the final component"
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "if set; else the directory specified via -p; else /tmp [deprecated] --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit"
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "mkstemp",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/mkstemp/3/json"
            },
            {
                "name": "mkdtemp",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/mkdtemp/3/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": [
                    {
                        "name": "-d --directory",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--directory"
                    },
                    {
                        "name": "-u --dry-run",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--dry-run"
                    },
                    {
                        "name": "-q --quiet",
                        "lines": 6,
                        "flag": "-q",
                        "long": "--quiet"
                    },
                    {
                        "name": "-p --tmpdir",
                        "lines": 4,
                        "flag": "-p",
                        "long": "--tmpdir"
                    },
                    {
                        "name": "-t",
                        "lines": 4,
                        "flag": "-t"
                    },
                    {
                        "name": "--version",
                        "lines": 2,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ]
    }
}