touch, settime - change file access and modification times
touch [-acm] [-r ref_file | -t time] file...
touch [-acm] [date_time] file...
settime [-f ref_file] [date_time] file...
The touch utility sets the access and modification times of each file. The file operand is created if it does not already exist.
The time used can be specified by -t time, by the corresponding time fields of the file referenced by -r ref_file, or by the date_time operand. If none of these are specified, touch uses the current time (the value returned by the time(2) function).
If neither the -a nor -m options are specified, touch updates both the modification and access times.
A user with write access to a file, but who is not the owner of the file or a super-user, can change the modification and access times of that file only to the current time. Attempts to set a specific time with touch will result in an error.
The settime utility is equivalent to touch -c [date_time] file.
The following options are supported in the touch and settime utilities:
The following options are supported for the touch utility:
-a
-c
-m
-r ref_file
-t time
[[CC]YY]MMDDhhmm[.SS]
where each two digits represent the following:
MM
DD
hh
mm
CC
YY
SS
Both CC and YY are optional. If neither is given, the current year will be assumed. If YY is specified, but CC is not, CC will be derived as follows:
|
The resulting time will be affected by the value of the TZ environment variable. If the resulting time value precedes the Epoch, touch will exit immediately with an error status. The range of valid times is the Epoch to January 18, 2038.
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 will be one or two seconds after a time where SS is 59. If SS is not given, it is assumed to be 0.
The following option is supported for the settime utility:
-f ref_file
The following operands are supported for the touch and settime utilities:
file
date_time
MMDDhhmm[YY]
where each two digits represent the following:
MM
DD
hh
mm
YY
YY is optional. If it is omitted, the current year will be assumed. If YY is specified, the year will be derived as follows:
|
If no -r option is specified, no -t option is specified, at least two operands are specified, and the first operand is an eight- or ten-digit decimal integer, the first operand will be assumed to be a date_time operand. Otherwise, the first operand will be assumed to be a file operand.
See largefile(5) for the description of the behavior of touch when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
When existing file access and modification times cannot be determined (which will occur if a call to stat(2) fails), both times can be changed to known values by settime and utime(2). However, in this case, touch -a (without -m) and touch -m (without -a) will fail because the unchanged time cannot be preserved.
See environ(5) for descriptions of the following environment variables that affect the execution of touch: LANG, LC_ALL, LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
TZ
The following exit values are returned:
0
>0
See attributes(5) for descriptions of the following attributes:
|
stat(2), time(2), utime(2), attributes(5), environ(5), largefile(5), standards(5)
Users familiar with the BSD environment will find that for the touch utility, the -f option is accepted but ignored. The -f option is unnecessary because touch will succeed for all files owned by the user regardless of the permissions on the files.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |