HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

mktemp — Create a temporary file or directory. More information: <https://keith.github.io/xcode-man-pages/mkt

Submitted by: @import:tldr-pages··
0
Viewed 0 times
directorycreatecommandtemporarymktempclifilemore
macos

Problem

How to use the mktemp command: Create a temporary file or directory. More information: <https://keith.github.io/xcode-man-pages/mktemp.1.html>.

Solution

mktemp — Create a temporary file or directory. More information: <https://keith.github.io/xcode-man-pages/mktemp.1.html>.

Create an empty temporary file and print its absolute path:
mktemp


Use a custom directory (defaults to the output of getconf DARWIN_USER_TEMP_DIR, or /tmp):
mktemp --tmpdir /{{path/to/temporary_directory}}


Use a custom path template (Xs are replaced with random alphanumeric characters):
mktemp {{/tmp/example.XXXXXXXX}}


Use a custom file name prefix:
mktemp -t {{example}}


Create an empty temporary directory and print its absolute path:
mktemp --directory

Code Snippets

Create an empty temporary file and print its absolute path

mktemp

Use a custom directory (defaults to the output of `getconf DARWIN_USER_TEMP_DIR`, or `/tmp`)

mktemp --tmpdir /{{path/to/temporary_directory}}

Use a custom path template (`X`s are replaced with random alphanumeric characters)

mktemp {{/tmp/example.XXXXXXXX}}

Use a custom file name prefix

mktemp -t {{example}}

Create an empty temporary directory and print its absolute path

mktemp --directory

Context

tldr-pages: osx/mktemp

Revisions (0)

No revisions yet.