Spec-Zone.ru › Nushell

mktemp for filesystem

Create temporary files or directories using uutils/coreutils mktemp.

Signature

> mktemp {flags} (template)

Flags

  • --suffix {string}: Append suffix to template; must not contain a slash.
  • --tmpdir-path, -p {path}: Interpret TEMPLATE relative to tmpdir-path. If tmpdir-path is not set use $TMPDIR.
  • --tmpdir, -t: Interpret TEMPLATE relative to the system temporary directory. It is implied if template is not provided.
  • --directory, -d: Create a directory instead of a file.
  • --dry: Don't create a file and just return the path that would have been created.

Parameters

  • template: Optional pattern from which the name of the file or directory is derived. Must contain at least three 'X's in last component.

Input/output types:

input output
nothing string

Examples

Make a temporary file with the given suffix in the system temp directory.

> mktemp --suffix .txt
/tmp/tmp.lekjbhelyx.txt

Make a temporary file named testfile.XXX with the 'X's as random characters in the current working directory.

> mktemp testfile.XXX
<WORKING_DIR>/testfile.4kh

Make a temporary file with a template in the system temp directory.

> mktemp -t testfile.XXX
/tmp/testfile.4kh

Make a temporary directory with randomly generated name in the temporary directory.

> mktemp -d
/tmp/tmp.NMw9fJr8K0

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/mktemp.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API