Name

touch

Synopsis

    touch [options] [date]files

For one or more files, update the access time and modification timestamp to the current time and date, or update to the optional date. date is a date and time in the format mmddhhmm [ yy ]. touch creates the files if they don’t exist. touch is useful in forcing other commands to handle files a certain way; e.g., the operation of make, and sometimes find, relies on a file’s access and modification times.

Common Options

-a, --time=access, --time=atime, --time=use

Update only the access time.

-c, --no-create

Do not create nonexistent files.

-m, --time=modify, --time=mtime

Update only the modification time.

-rfile, --reference=file

Use the access and/or modification times of file instead of the current time.

-t time

Use the time as it is provided by time, which has the form [[ cc ]yy ]mmddhhmm [. ss ].

GNU/Linux Options

-dtime, --date=time

Change the time value to the specified time instead of the current time. time can use several formats and may contain month names, time zones, a.m. and p.m. strings, etc.

-f

Accepted but ignored.

Mac OS X Option

-f

Force; attempt to update the times, even if the file permissions do not allow it.

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.