commands

touch — update timestamps or create empty files

Updates access and modification times by default; a missing ordinary file is created empty unless creation is disabled. Existing file data is not truncated. Examples assume a fresh chapter files lab.

Formal Syntax & Structure

linux syntaxlinux
touch [OPTION]... FILE...

Parameters & Attributes

NameTypeDescription
-coptionDo not create a missing file
-moptionChange only modification time
FILEoperandFile to touch

Return Value

filesystem change and exit status

GNU touch returns 0 on successful timestamp updates or creation and nonzero on failure. Inspect file metadata and existence; existing contents are not replaced by this operation.

Working Example

Example Snippetlinux
touch notes/new.txt
Linux Reference