Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

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 specied by -t, -r, or by the time argument. If you do not specify a time,
touch uses the current time. If you specify a le that does not exist, touch creates a le with that
name unless you request otherwise with the -c ag.
If neither the -a or -m ags are specied, touch behaves as though both of these ags were
specied.
The LC_TIME environment variable, if dened, species the order of month and day in the date
specication and of hour and minute in the time specication. 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 modication times of a le, enter:
touch program.c
This sets the last access and last modication times of program.c to the current date and
time. If program.c does not exist, touch creates an empty le with that name.
2. To avoid creating a new le, enter:
touch -c program.c
3. To update only the modication time, enter:
touch -m *.o
This updates only the last modication times of the les 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 modication times, enter:
touch -c -t 02171425 program.c
This sets the access and modication 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 le with a numeric lename, include its full pathname or precede it with ./,so
that the lename is not mistaken for the time argument. For example, to touch the le
123.abc,enter:
touch -c ./123.abc
CAUTION
Do not use the touch command on les in the Guardian Environment.
916 Hewlett-Packard Company 527188-004