1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-07 16:16:03 +02:00
tldr/pages/linux/mktemp.md
2023-08-31 15:47:51 +02:00

21 lines
711 B
Markdown

# mktemp
> Create a temporary file or directory.
> Note that examples here all assume `$TMPDIR` is unset.
> More information: <https://www.gnu.org/software/autogen/mktemp.html>.
- Create an empty temporary file in `/tmp/` and print its absolute path:
`mktemp`
- Create a temporary directory in `/tmp/` and print its absolute path:
`mktemp --directory`
- Create an empty temporary file at the specified path, with `X`s replaced with random alphanumeric characters, and print its path:
`mktemp "{{path/to/file_XXXXX_name}}"`
- Create an empty temporary file in `/tmp/` with the specified name, with `X`s replaced with random alphanumeric characters, and print its path:
`mktemp -t "{{file_XXXXX_name}}"`