mktemp.1 (1293B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-09-20
- .Dt MKTEMP 1
- .Os
- .Sh NAME
- .Nm mktemp
- .Nd make a new randomly-named file or directory
- .Sh SYNOPSIS
- .Nm
- .Op Fl dqtu
- .Op Fl p Ar tempdir
- .Op Ar template
- .Sh DESCRIPTION
- .Nm
- creates a new randomly-named file or directory,
- and prints its name.
- .Pp
- .Ar template
- must contain at least 6 consecutive
- .Ql X
- as last path component.
- If
- .Ar template
- is not specified,
- .Ql tmp.XXXXXXXXXX
- is used instead.
- .br
- Files are created with u+rw permissions, directories with u+rwx.
- .Sh OPTIONS
- .Bl -tag -width _d
- .It Fl d
- Create a directory, not a file.
- .It Fl q
- Quiet messages about file/directory creation failure.
- .It Fl p Ar tempdir
- Specify
- .Ar tempdir
- as an existing directory to create into.
- Overrides
- .Ev TMPDIR .
- .It Fl t
- Use
- .Ev TMPDIR
- or if unset,
- .Pa /tmp ,
- as an existing directory to create into.
- .It Fl u
- Unsafe mode, generate filename and print it out without creating it.
- .Pp
- Only present for compatibility with existing scripts, do not use.
- .El
- .Sh EXIT STATUS
- .Ex -std
- .Sh HISTORY
- An
- .Nm
- utility first appeared in
- .Nx 1.5
- and
- .Ox 2.1
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me