update access and modification times of a file
touch [-amc] [-rref_file |
-ttime] file ...
touch [-amc] [MMDDhhmm[YY]]
causes the access and modification times of each
argument to be updated.
The file name is created if it does not exist.
If no time is specified
the current time is used.
for a description of the time format used in the second
touch has the following options:
Update only the access time.
Update only the modification time.
If neither -a nor -m is specified, the effect is the same
from creating the file if it did not
Use the corresponding time of ref_file instead of the current time.
Use time instead of the current time. time is a decimal
number of the form:
where each two digits represent the following:
month of the year (01-12)
day of the month (01-31)
hour of the day (00-23)
minute of the hour (00-59)
first two digits of the year (the century)
second two digits of the year
second of the minute (00-61)
CC and YY are optional. If neither is given, the current
year is assumed. If YY is specified, but CC is not,
CC is derived as follows:
If YY is:
The range for SS is (00-61), because of leap seconds. If
SS is 60 or 61 and the resulting time, as affected by the
TZ environment variable, does not refer to a leap second; the
resulting time shall be one or two seconds after a time where SS
is 59. If SS is not given it is assumed to be zero.
language-specific message file (see LANG on
The return code from
is the number of files for which the times could not
be successfully modified
(including files that did not exist and were not created).
If the POSIX2 environment variable is set and exported, files that did not
exist and were not created are not considered to be errors,
and will not increment the return code.
Users familiar with the
environment will find that the
option is accepted, but ignored.
option is unnecessary since
will succeed for all files owned by the user regardless of
the permissions on the files.
The touch command assumes that an operand is a date if and only
if all of the following are true:
-r, -t, and -f are not specified
there are at least two operands
the second operand is 8 or 10 digits
The -ttime option should be used in preference to the
second synopsis usage, since the second synopsis may not be supported
in future releases.
This command has been updated to handle files greater than 2GB.