Forrest logo
back to the mktemp tool

mktemp:tldr:1979b

mktemp: Create a temporary directory and print the absolute path to it.
$ mktemp --directory
try on your machine

The command "mktemp --directory" is used to create a temporary directory or folder with a unique name.

When you run this command, the "mktemp" utility creates a temporary directory in a secure manner. It generates a random name for the directory to avoid any naming conflicts with existing directories or files.

The "--directory" option specifies that a directory needs to be created. Without this option, "mktemp" would create a temporary file instead of a directory.

Temporary directories are commonly used in shell scripts or other programs when you need a temporary workspace to perform certain tasks or store temporary files. Once the task is complete or the program terminates, the temporary directory and its contents are automatically deleted.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mktemp tool