DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

touch(1)


touch -- update access and modification times of a file

Synopsis

touch [-amc] [-r ref_file | -t time] file ...

touch [-amc] [MMDDhhmm[YY]] file ...

Description

touch 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. (See date(1) for a description of the time format used in the second synopsis.) touch has the following options:

-a
Update only the access time.

-m
Update only the modification time.

If neither -a nor -m is specified, the effect is the same as -am.


-c
Silently prevent touch from creating the file if it did not previously exist.

-r ref_file
Use the corresponding time of ref_file instead of the current time.

-t time
Use time instead of the current time. time is a decimal number of the form:
   [[CC]YY]MMDDhhmm[.SS]
where each two digits represent the following:

MM
month of the year (01-12)

DD
day of the month (01-31)

hh
hour of the day (00-23)

mm
minute of the hour (00-59)

CC
first two digits of the year (the century)

YY
second two digits of the year

SS
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: CC becomes:
69-99 19
00-68 20

 If YY is:   CC becomes:
 69-99       19
 00-68       20
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.

Files


/usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
language-specific message file (see LANG on environ(5)).

Exit codes

The return code from touch 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.

References

date(1), utime(2)

Notices

Users familiar with the BSD environment will find that the -f option is accepted, but ignored. The -f option is unnecessary since touch 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:

The -t time 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.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004