Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)

touch(1) OSS Shell and Utilities Reference Manual
The range for SS is 00-61 rather than 00-59 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 is one or two seconds after a time where SS is 59. If SS
is not given a value, it is assumed to be 0 (zero).
DESCRIPTION
The time used can be specified by -t, -r, or by the time argument. If you do not specify a time,
touch uses the current time. If you specify a file that does not exist, touch creates a file with that
name unless you request otherwise with the -c flag.
If neither the -a or -m flags are specified, touch behaves as though both of these flags were
specified.
The LC_TIME environment variable, if defined, specifies the order of month and day in the date
specification and of hour and minute in the time specification. Otherwise, these orders default to
MMdd and hhmm.
The obsolescent format for the time argument is MMddhhmm[yy].
EXAMPLES
1. To update the access and modification times of a file, enter:
touch program.c
This sets the last access and last modification times of program.c to the current date and
time. If program.c does not exist, touch creates an empty file with that name.
2. To avoid creating a new file, enter:
touch -c program.c
3. To update only the modification time, enter:
touch -m *.o
This updates only the last modification times of the files in the current directory that end
with .o. The touch command is often used in this way to alter the results of the make
command.
4. To explicitly set the access and modification times, enter:
touch -c -t 02171425 program.c
This sets the access and modification dates to 14:25 (2:25 p.m.) February 17 of the
current year. (This assumes that you are using the default format.)
5. To touch a file with a numeric filename, include its full pathname or precede it with ./,so
that the filename is not mistaken for the time argument. For example, to touch the file
123.abc,enter:
touch -c ./123.abc
CAUTION
Do not use the touch command on files in the Guardian Environment.
916 Hewlett-Packard Company 527188-021