touch - update access and modification times of a file
touch [ -amc ] [ mmddhhmm[yy] ] files
touch [ -amc ] [ -r ref_file | -t [[cc]yy]mmddhhmm[.ss] ] files
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 [see date(1)] the current time is used. The -a and -m options
cause touch to update only the access or modification times respectively
(default is -am). The -c option silently prevents touch from creating
the file if it did not previously exist. The -r option causes touch to
use the modification time of the file named by the pathname ref_file
instead of of the current time.
The -t [[cc]yy]mmddhhmm[.ss] option specifies to the time to use instead
of the current time. The option-argument will be a decimal number where
each two digits represents the following:
mm The month of the year [01-12].
dd The day of the month [01-31].
hh The hour of the day [00-23].
mm The minute of the hour [00-59].
cc The first two digits of the year (century).
yy The second two digits of the year.
ss The second of the minute [00-61].
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:
If yy is: 69-99 then cc becomes 19.
If yy is: 00-68 then cc becomes 20.
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 a value, it is assumed to be zero.
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).
language-specific message file [See LANG on environ (5).]
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
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
specification of the form mmddhhmm[yy]. Otherwise, the first operand
will be assumed to be a file name.
PPPPaaaaggggeeee 2222 [ Back ]