touch [-acfm] [-r referenceFile] [-t [[CC]YY]MMDDhhmm[.ss]] file …
Sets the modification and access times of files
If the file doesn't exist, it is created .
Default now,
-c |
Time may be specified as the first argument. If YY
is in the range 39 to 99,
CC
is set to 19, otherwise, CC
is set to 20
Notice that this is different from the start year with -t
usage: touch [-A [-][[hh]mm]SS] [-achm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]]
[-d YYYY-MM-DDThh:mm:SS[.frac][tz]] file ...
Did you leave out the filename?
touch [-acfm] [[MMDDhhmm[YY]]
† file …
Alphabetic characters in the time cause the time to be treated as a file which will be created and file
wil be updated with now!.
Illegal decimal values:
For example without -t | 18 01022359 |
Don't omit YY
other wise time may be set to the future (for example touch 12312359 futureFile.txt
).
ls -l futureFile.txt -rw-r--r-- 1 0 Dec 31 2022 futureFile.txtOmmitting the
-
before the t
will make a file named t
unless -c
is specified in which case it woun't do anything and won't complain.See utimes