-
- touch - change file access, modification and status change times
-
- touch [ options ] [ date ]file ...
-
- touch changes the modification time, access time or both of each file. The modification time is the st_mtime member of the stat(2)
information and the access time is the st_atime member. On most systems the file status change time is always set to the current time when either the access
or modification times are changed.
- If neither the --reference nor the --time options are specified then the time used will be the date operand or the current time if date
is omitted.
- If the date operand consists of 4, 6, 8, 10 or 12 digits followed by an optional . and two digits then it is interpreted as: HHMM.SS, ddHHMM.SS
, mmddHHMM.SS, mmddHHMMyy.SS or yymmddHHMM.SS, or mmddHHMMccyy.SS or ccyymmddHHMM.SS. Conflicting standards and practice
allow a leading or trailing 2 or 4 digit year for the 10 and 12 digit forms; the X/Open leading form is used to disambiguate (date(1)
uses the trailing form.) Avoid the 10 digit form to avoid confusion. The digit fields are:
- cc
- Century - 1, 19-20.
- yy
- Year in century, 00-99.
- mm
- Month, 01-12.
- dd
- Day of month, 01-31.
- HH
- Hour, 00-23.
- MM
- Minute, 00-59.
- SS
- Seconds, 00-60.
-
- -a, --access|atime|use
- Change the access time. Do not change the modification time unless --modify is also specified.
- -c, --create
- Create the file if it does not exist, but write no diagnostic. On by default; -c means --nocreate.
- -f, --force
- Ignored by this implementation.
- -m, --modify|mtime|modification
- Change the modify time. Do not change the access time unless --access is also specified.
- -r, --reference=file
- Use the corresponding time of file instead of the current time.
- -s|n, --change|ctime|neither
- Change only the file status change time st_ctime. Most systems summarily set st_ctime to the
current time.
- -t|d, --time|date=date-time
- Use the specified date-time instead of the current date-time. Most common formats are accepted. See tmdate(3)
for details. If date-time consists of 4, 6, 8, 10 or 12 digits followed by an optional . and 2 digits and another optional . and 1 or more
digits then it is interpreted as the date operand above, except that the leading 2 or 4 digit year form is used to disambiguate. Avoid the 10 digit form to
avoid confusion. If --reference is specified or if file already exists then time may also be one of:
- access|atime|use
- The access time of the reference file.
- change|ctime
- The change time of the reference file.
- modify|mtime|modification
- The modify time of the reference file.
- -v, --verbose
- Write a diagnostic for each nonexistent file.
-
- Some systems or file system types may limit the range of times that can be set. These limitations may not show up until a subsequent stat(2)
call (yes, the time can be set but not checked!) Upper limits of <0xffffffff and <0x7fffffff have been observed.
-
- date(1), nmake(1), utime(2),
tm(3)
-
- version
- touch (AT&T Research) 2004-12-12
- author
- Glenn Fowler <gsf@research.att.com>
- copyright
- Copyright © 1989-2008 AT&T Intellectual Property
- license
- http://www.opensource.org/licenses/cpl1.0.txt