touch.1 (2010 09)
t
touch(1) touch(1)
NAME
touch - update access, modification, and/or change times of file
SYNOPSIS
touch [-amc][-r
ref_file | -t time] file_name ...
Obsolescent
touch time_str file_name ...
DESCRIPTION
touch updates the access, modification, and last-change times of each argument. The file name is
created if it does not exist. If no time is specified (see date (1)) the current time is used.
The
-r and -t options are mutually exclusive.
Options
The following options are available:
-a Change the access time of file_name to time , or to the current time if time is not
specified. Do not change the modification time unless
-m is also specified.
-m Change the modification time of file_name to time, or to the current time if time is
not specified. Do not change the access time unless
-a is also specified.
-c Silently prevent touch from creating the file if it did not previously exist. Do not
write any diagnostic messages concerning this condition.
-r ref_file Use the corresponding time of ref_file instead of the current time.
-t time Use the specified time instead of the current time. The option argument is a
decimal number of the form:
[[CC]YY]MMDDhhmm[
.SS]
where each two digits represents the following:
CC The first two digits of the year.
YY The second two digits of the year.
MM The month of the year (01-12).
DD The day of the month (01-31).
hh The hour of the day (00-23).
mm The minute of the hour (00-59).
SS The second of the minute (00-61).
If neither CC nor YY is given, the current year is assumed. If YY is specified, but
CC is not, CC is derived as follows: (taken into account the local time factor)
If YY is: CC becomes:
69-99 19
00-68 20
If the resulting time value precedes the Epoch (00:00:00 January 1, 1970 Greenwich
Mean Time),
touch exits immediately with an error status.
The range for SS is 00 through 61 rather than 00 through 59 to accommodate leap
seconds. If SS is 60 or 61, and the resulting time, as affected by the
TZ environ-
ment variable, does not refer to a leap second, the resulting time is one second after
a time where SS is 59. If SS is not given a value, it is assumed to be 0.
The syntax shown by the second SYNOPSIS line is recognized when neither the
-r option, the -t
option, nor the -- option delimiter is specified, and the first operand consists of all decimal digits. This
operand is interpreted as the time argument instead of as a file name. However, in this case, time_str is
assumed to be of the form:
MMDDhhmm[YY]
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1