TOUCH(1)                                                 TOUCH(1)



NAME

       touch - change file timestamps


SYNOPSIS

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

       Obsolescent version:
       touch [-acm][ugly_time] file...

       GNU version:
       touch   [-acfm]   [-r   file]  [-t  decimtime]  [-d  time]
       [--time={atime,access,use,mtime,modify}]     [--date=time]
       [--reference=file] [--no-create] [--help] [--version] [--]
       file...


DESCRIPTION

       touch changes the access and/or modification timestamps of
       each  specified file.  These timestamps are changed to the
       current time, unless the -r option is specified, in  which
       case  they  are changed to the corresponding timestamps of
       the file ref_file, or the -t option is specified, in which
       case  they  are changed to the specified time.  Both times
       are changed when neither or both of the -a and -m  options
       are  given.  Only the access or only the modification time
       is changed when one of the options -a and -m is given.  If
       the  file  did  not  exist yet, it is created (as an empty
       file with mode 0666, modified by the umask), unless the -c
       option is given.


POSIX OPTIONS

       -a     Change the access time of file.

       -c     Do not create file.

       -m     Change the modification time of file.

       -r ref_file
              Use  the corresponding timestamp of ref_file as the
              new value for the changed timestamp(s).

       -t time
              Use the specified time as the  new  value  for  the
              changed  timestamp(s).   The  argument is a decimal
              number of the form
                  [[CC]YY]MMDDhhmm[.SS]
              with the obvious meaning. If CC is  not  specified,
              the   year  CCYY  is  taken  to  be  in  the  range
              1969-2068.  If SS is not specified, it is taken  to
              be 0. It may be specified in the range 0-61 so that
              it is possible  to  refer  to  leap  seconds.   The
              resulting time is taken as a time for the time zone
              specified by the environment variable TZ. It is  an
              error  if  the  resulting  time  precedes 1 January
              1970.



GNU fileutils 4.0         November 1998                         1





TOUCH(1)                                                 TOUCH(1)


       --     Terminate option list.


POSIX DETAILS

       The second form of invocation has  the  disadvantage  that
       there  is some ambiguity as to whether ugly_time is a time
       or a file argument. It is taken to be a time when no -r or
       -t  option  is  present, there are at least two arguments,
       and the first argument is an eight- or  ten-digit  decimal
       integer.   The  format of ugly_time is MMDDhhmm[yy], where
       an yy in the range 69-99  denotes  a  year  in  the  range
       1969-1999, and an unspecified yy denotes the current year.
       This form is obsolete.


GNU DETAILS

       If the first file would be a  valid  argument  to  the  -t
       option and no timestamp is given with any of the -d, -r or
       -t options and the `--' argument is not given, that  argu-
       ment  is  interpreted  as  the  time  for  the other files
       instead of as a file name.

       If changing both the access and modification times to  the
       current  time,  touch  can change the timestamps for files
       that the user running it does not own but has  write  per-
       mission for.  Otherwise, the user must own the files.


GNU OPTIONS

       -a, --time=atime, --time=access, --time=use
              Change the access time only.

       -c, --no-create
              Do not create files that do not exist.

       -d, --date=time
              Use  time instead of the current time.  It can con-
              tain month names, time zones, `am' and `pm', etc.

       -f     Ignored; for compatibility  with  BSD  versions  of
              touch(1).

       -m, --time=mtime, --time=modify
              Change the modification time only.

       -r file, --reference=file
              Use  the times of the reference file instead of the
              current time.

       -t decimtime
              Here decimtime has the format MMDDhhmm[[CC]YY][.ss]
              Use  the  argument  (months,  days, hours, minutes,
              optional  century  and  years,  optional   seconds)
              instead of the current time.  Note that this format
              violates the POSIX specification.





GNU fileutils 4.0         November 1998                         2





TOUCH(1)                                                 TOUCH(1)



GNU STANDARD OPTIONS

       --help Print a usage message on standard output  and  exit
              successfully.

       --version
              Print  version information on standard output, then
              exit successfully.

       --     Terminate option list.


ENVIRONMENT

       The variable TZ is  used  to  interpret  explicitly  given
       times.   The  variables LANG, LC_ALL, LC_CTYPE and LC_MES-
       SAGES have the usual meaning.


CONFORMING TO

       POSIX 1003.2 describes a syntax for the argument of the -t
       option  that differs from that used by the GNU implementa-
       tion.


EXAMPLE OF USE

       The command `touch foo' will create the  file  foo  if  it
       didn't  exist, and change the time of last modification to
       now.  It is often used to guide the actions of make.


NOTES

       This page describes touch as found  in  the  fileutils-4.0
       package; other versions may differ slightly.  Mail correc-
       tions and additions to aeb@cwi.nl.   Report  bugs  in  the
       program to fileutils-bugs@gnu.ai.mit.edu.



























GNU fileutils 4.0         November 1998                         3