Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux touch command

Create an empty file, or update an existing file’s modification time.

GNU Coreutils

Syntax

Command form
touch [OPTION]... FILE...

Common options

6 options
OptionWhat it does
-aChange only the access time.
-mChange only the modification time.
-c, --no-createDo not create a missing file.
-d, --date=STRINGUse a parsed date/time instead of the current time.
-r, --reference=FILECopy timestamps from another file.
-t STAMPUse a timestamp in [[CC]YY]MMDDhhmm[.ss] format.

Usage examples

2 examples

Create an empty file, or update an existing file’s modification time.

touch notes.txt

Copy source.txt timestamps to copy.txt.

touch -r source.txt copy.txt

Notes

touch changes metadata rather than file contents; timestamp updates can affect build tools and backup software.