mktemp

Create a temporary file or directory. More information: <https://man.openbsd.org/mktemp.1>.

Install

All systems
curl cmd.cat/mktemp.sh
Debian Debian
apt-get install coreutils
Ubuntu
apt-get install coreutils
Alpine
apk add coreutils
Arch Arch Linux
pacman -S coreutils
image/svg+xml Kali Linux
apt-get install coreutils
CentOS
yum install coreutils
Fedora
dnf install coreutils
Windows (WSL2)
sudo apt-get update sudo apt-get install coreutils
OS X
brew install coreutils
Raspbian
apt-get install coreutils
Docker
docker run cmd.cat/mktemp mktemp powered by Commando

Create a temporary file or directory. More information: <https://man.openbsd.org/mktemp.1>.

  • 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/tempdir
  • Use a custom path template (`X`s 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

© tl;dr; authors and contributors