Spec-Zone.ru › Nushell

touch for filesystem

Creates one or more files.

Signature

> touch {flags} ...rest

Flags

  • --reference, -r {path}: Use the access and modification times of the reference file/directory instead of the current time.
  • --timestamp, -t {datetime}: Use the given timestamp instead of the current time.
  • --date, -d {string}: Use the given time instead of the current time. This can be a full timestamp or it can be relative to either the current time or reference file time (if given). For more information, see https://www.gnu.org/software/coreutils/manual/html_node/touch-invocation.html.
  • --modified, -m: Change only the modification time (if used with -a, access time is changed too).
  • --access, -a: Change only the access time (if used with -m, modification time is changed too).
  • --no-create, -c: Don't create the file if it doesn't exist.
  • --no-deref, -s: Affect each symbolic link instead of any referenced file (only for systems that can change the timestamps of a symlink). Ignored if touching stdout.

Parameters

  • ...rest: The file(s) to create. '-' is used to represent stdout.

Input/output types:

input output
nothing nothing

Examples

Creates "fixture.json".

> touch fixture.json

Creates files a, b and c.

> touch a b c

Changes the last modified time of "fixture.json" to today's date.

> touch -m fixture.json

Changes the last modified and accessed time of all files with the .json extension to today's date.

> touch *.json

Changes the last accessed and modified times of files a, b and c to the current time but yesterday.

> touch -d "yesterday" a b c

Changes the last modified time of files d and e to "fixture.json"'s last modified time.

> touch -m -r fixture.json d e

Changes the last accessed time of "fixture.json" to a datetime.

> touch -a -t 2019-08-24T12:30:30 fixture.json

Change the last accessed and modified times of stdout.

> touch -

Changes the last accessed and modified times of file a to 1 month before "fixture.json"'s last modified time.

> touch -r fixture.json -d "-1 month" a

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

Spec-Zone.ru

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