touch - change file timestamps
touch [-acm][-r ref_file|-t time] file...
touch [-acm][ugly_time] file...
touch [-acfm] [-r file] [-t decimtime] [-d time]
[--reference=file] [--no-create] [--help] [--version] [--]
touch changes the access and/or modification timestamps of
each specified file. These timestamps are changed to the
current time, unless the -r option is specified, in which
case they are changed to the corresponding timestamps of the
file ref_file, or the -t option is specified, in which case
they are changed to the specified time. Both times are
changed when neither or both of the -a and -m options are
given. Only the access or only the modification time is
changed when one of the options -a and -m is given. If the
file did not exist yet, it is created (as an empty file with
mode 0666, modified by the umask), unless the -c option is
-a Change the access time of file.
-c Do not create file.
-m Change the modification time of file.
Use the corresponding timestamp of ref_file as the new
value for the changed timestamp(s).
Use the specified time as the new value for the changed
timestamp(s). The argument is a decimal number of the
with the obvious meaning. If CC is not specified, the
year CCYY is taken to be in the range 1969-2068. If SS
is not specified, it is taken to be 0. It may be speci-
fied in the range 0-61 so that it is possible to refer
to leap seconds. The resulting time is taken as a time
for the time zone specified by the environment variable
TZ. It is an error if the resulting time precedes 1
The second form of invocation has the disadvantage that
there is some ambiguity as to whether ugly_time is a time or
a file argument. It is taken to be a time when no -r or -t
option is present, there are at least two arguments, and the
first argument is an eight- or ten-digit decimal integer.
The format of ugly_time is MMDDhhmm[yy], where an yy in the
range 69-99 denotes a year in the range 1969-1999, and an
unspecified yy denotes the current year. This form is
If the first file would be a valid argument to the -t option
and no timestamp is given with any of the -d, -r or -t
options and the `--' argument is not given, that argument is
interpreted as the time for the other files instead of as a
If changing both the access and modification times to the
current time, touch can change the timestamps for files that
the user running it does not own but has write permission
for. Otherwise, the user must own the files.
-a, --time=atime, --time=access, --time=use
Change the access time only.
Do not create files that do not exist.
Use time instead of the current time. It can contain
month names, timezones, `am' and `pm', etc.
-f Ignored; for compatibility with BSD versions of
-m, --time=mtime, --time=modify
Change the modification time only.
-r file, --reference=file
Use the times of the reference file instead of the
Here decimtime has the format MMDDhhmm[[CC]YY][.ss] Use
the argument (months, days, hours, minutes, optional
century and years, optional seconds) instead of the
current time. Note that this format violates the POSIX
GNU STANDARD OPTIONS
Print a usage message on standard output and exit suc-
Print version information on standard output, then exit
-- Terminate option list.
The variable TZ is used to interpret explicitly given times.
The variables LANG, LC_ALL, LC_CTYPE and LC_MESSAGES have
the usual meaning.
POSIX 1003.2 describes a syntax for the argument of the -t
option that differs from that used by the GNU implementa-
EXAMPLE OF USE
The command `touch foo' will create the file foo if it
didn't exist, and change the time of last modification to
now. It is often used to guide the actions of make.
This page describes touch as found in the fileutils-3.16
package; other versions may differ slightly. Mail correc-
tions and additions to firstname.lastname@example.org and email@example.com
and firstname.lastname@example.org . Report bugs in the program