man.lsPlain-English help for Unix commands

touch Create empty files or change file timestamps

Creates an empty file if the name does not exist yet. If it does exist, touch updates its access and modification times without changing the contents. You reach for it to make placeholder files or to fake or fix a file's date.

Synopsis

touch [OPTION]... FILE...
touch -t [[CC]YY]MMDDhhmm[.ss] FILE...

Common options

Option or formWhat it does
-cDo not create the file if it does not exist. No error is shown
-tSet the time to [[CC]YY]MMDDhhmm[.ss], for example 202601151030 for 15 January 2026 at 10:30
-dSet the time from a date string such as "2026-01-15 10:30:00". Accepted formats differ between macOS and GNU/Linux (see notes)
-rCopy the times from another file instead of using the current time
-aChange only the access time
-mChange only the modification time
-hIf the file is a symbolic link, change the link itself, not the file it points to. Implies -c

Examples

Create an empty file
touch new.txt
Create several files at once
touch one.txt two.txt three.txt
Update the time on a file only if it already exists
touch -c notes.txt missing.txt
Set a file's modification time to a fixed date
touch -t 202601151030 notes.txt
Make one file the same age as another
touch -r notes.txt copy.txt
Set an exact time down to the second
touch -t 202601151030.45 app.log

Notes

See also

Last reviewed 2026-10-07.