1*71d1d39eSZachary Storer.\" $NetBSD: touch.1,v 1.25 2012/10/24 02:46:25 pgoyette Exp $ 2*71d1d39eSZachary Storer.\" 3*71d1d39eSZachary Storer.\" Copyright (c) 1991, 1993 4*71d1d39eSZachary Storer.\" The Regents of the University of California. All rights reserved. 5*71d1d39eSZachary Storer.\" 6*71d1d39eSZachary Storer.\" This code is derived from software contributed to Berkeley by 7*71d1d39eSZachary Storer.\" the Institute of Electrical and Electronics Engineers, Inc. 8*71d1d39eSZachary Storer.\" 9*71d1d39eSZachary Storer.\" Redistribution and use in source and binary forms, with or without 10*71d1d39eSZachary Storer.\" modification, are permitted provided that the following conditions 11*71d1d39eSZachary Storer.\" are met: 12*71d1d39eSZachary Storer.\" 1. Redistributions of source code must retain the above copyright 13*71d1d39eSZachary Storer.\" notice, this list of conditions and the following disclaimer. 14*71d1d39eSZachary Storer.\" 2. Redistributions in binary form must reproduce the above copyright 15*71d1d39eSZachary Storer.\" notice, this list of conditions and the following disclaimer in the 16*71d1d39eSZachary Storer.\" documentation and/or other materials provided with the distribution. 17*71d1d39eSZachary Storer.\" 3. Neither the name of the University nor the names of its contributors 18*71d1d39eSZachary Storer.\" may be used to endorse or promote products derived from this software 19*71d1d39eSZachary Storer.\" without specific prior written permission. 20*71d1d39eSZachary Storer.\" 21*71d1d39eSZachary Storer.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22*71d1d39eSZachary Storer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23*71d1d39eSZachary Storer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24*71d1d39eSZachary Storer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25*71d1d39eSZachary Storer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26*71d1d39eSZachary Storer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27*71d1d39eSZachary Storer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28*71d1d39eSZachary Storer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29*71d1d39eSZachary Storer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30*71d1d39eSZachary Storer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31*71d1d39eSZachary Storer.\" SUCH DAMAGE. 32*71d1d39eSZachary Storer.\" 33*71d1d39eSZachary Storer.\" @(#)touch.1 8.3 (Berkeley) 4/28/95 34*71d1d39eSZachary Storer.\" 35*71d1d39eSZachary Storer.Dd October 22, 2012 36*71d1d39eSZachary Storer.Dt TOUCH 1 37*71d1d39eSZachary Storer.Os 38*71d1d39eSZachary Storer.Sh NAME 39*71d1d39eSZachary Storer.Nm touch 40*71d1d39eSZachary Storer.Nd change file access and modification times 41*71d1d39eSZachary Storer.Sh SYNOPSIS 42*71d1d39eSZachary Storer.Nm 43*71d1d39eSZachary Storer.Op Fl acfhm 44*71d1d39eSZachary Storer.Op Fl d Ar human-datetime 45*71d1d39eSZachary Storer.Op Fl Fl date Ar human-datetime 46*71d1d39eSZachary Storer.Op Fl r Ar file 47*71d1d39eSZachary Storer.Op Fl Fl reference Ar file 48*71d1d39eSZachary Storer.Op Fl t Ar datetime 49*71d1d39eSZachary Storer.Ar file ... 50*71d1d39eSZachary Storer.Sh DESCRIPTION 51*71d1d39eSZachary StorerThe 52*71d1d39eSZachary Storer.Nm 53*71d1d39eSZachary Storerutility changes the access and modification times of files to the 54*71d1d39eSZachary Storercurrent time of day. 55*71d1d39eSZachary StorerIf the file doesn't exist, it is created with default permissions. 56*71d1d39eSZachary Storer.Pp 57*71d1d39eSZachary StorerThe following options are available: 58*71d1d39eSZachary Storer.Bl -tag -width "-d human-datetime" 59*71d1d39eSZachary Storer.It Fl a 60*71d1d39eSZachary StorerChange the access time of the file. 61*71d1d39eSZachary StorerThe modification time of the file is not changed unless the 62*71d1d39eSZachary Storer.Fl m 63*71d1d39eSZachary Storerflag is also specified. 64*71d1d39eSZachary Storer.It Fl c 65*71d1d39eSZachary StorerDo not create the file if it does not exist. 66*71d1d39eSZachary StorerThe 67*71d1d39eSZachary Storer.Nm 68*71d1d39eSZachary Storerutility does not treat this as an error. 69*71d1d39eSZachary StorerNo error messages are displayed and the exit value is not affected. 70*71d1d39eSZachary Storer.It Fl d Ar human-datetime 71*71d1d39eSZachary Storer.It Fl Fl date Ar human-datetime 72*71d1d39eSZachary StorerParse 73*71d1d39eSZachary Storer.Ar human-datetime 74*71d1d39eSZachary Storerusing the human datetime parser 75*71d1d39eSZachary Storer.Xr parsedate 3 . 76*71d1d39eSZachary Storer.It Fl f 77*71d1d39eSZachary StorerThis flag has no effect; it is accepted for compatibility reasons. 78*71d1d39eSZachary Storer.It Fl h 79*71d1d39eSZachary StorerIf 80*71d1d39eSZachary Storer.Ar file 81*71d1d39eSZachary Storeris a symbolic link, access and/or modification time of the link is changed. 82*71d1d39eSZachary StorerThis option implies 83*71d1d39eSZachary Storer.Fl c . 84*71d1d39eSZachary Storer.It Fl m 85*71d1d39eSZachary StorerChange the modification time of the file. 86*71d1d39eSZachary StorerThe access time of the file is not changed unless the 87*71d1d39eSZachary Storer.Fl a 88*71d1d39eSZachary Storerflag is also specified. 89*71d1d39eSZachary Storer.It Fl r Ar file 90*71d1d39eSZachary Storer.It Fl Fl reference Ar file 91*71d1d39eSZachary StorerUse the access and modifications times from 92*71d1d39eSZachary Storer.Ar file 93*71d1d39eSZachary Storerinstead of the current time of day. 94*71d1d39eSZachary Storer.It Fl t Ar datetime 95*71d1d39eSZachary StorerChange the access and modification times to the specified time. 96*71d1d39eSZachary StorerThe argument 97*71d1d39eSZachary Storer.Ar datetime 98*71d1d39eSZachary Storershould be in the form 99*71d1d39eSZachary Storer.Dq [[CC]YY]MMDDhhmm[.SS] 100*71d1d39eSZachary Storerwhere each pair of letters represents the following: 101*71d1d39eSZachary Storer.Pp 102*71d1d39eSZachary Storer.Bl -tag -width Ds -compact -offset indent 103*71d1d39eSZachary Storer.It Ar CC 104*71d1d39eSZachary StorerThe first two digits of the year (the century). 105*71d1d39eSZachary Storer.It Ar YY 106*71d1d39eSZachary StorerThe second two digits of the year. 107*71d1d39eSZachary StorerIf 108*71d1d39eSZachary Storer.Dq YY 109*71d1d39eSZachary Storeris specified, but 110*71d1d39eSZachary Storer.Dq CC 111*71d1d39eSZachary Storeris not, a value for 112*71d1d39eSZachary Storer.Dq YY 113*71d1d39eSZachary Storerbetween 69 and 99 results in a 114*71d1d39eSZachary Storer.Dq CC 115*71d1d39eSZachary Storervalue of 19. 116*71d1d39eSZachary StorerOtherwise, a 117*71d1d39eSZachary Storer.Dq CC 118*71d1d39eSZachary Storervalue of 20 is used. 119*71d1d39eSZachary Storer.It Ar MM 120*71d1d39eSZachary StorerThe month of the year, from 1 to 12. 121*71d1d39eSZachary Storer.It Ar DD 122*71d1d39eSZachary StorerThe day of the month, from 1 to 31. 123*71d1d39eSZachary Storer.It Ar hh 124*71d1d39eSZachary StorerThe hour of the day, from 0 to 23. 125*71d1d39eSZachary Storer.It Ar mm 126*71d1d39eSZachary StorerThe minute of the hour, from 0 to 59. 127*71d1d39eSZachary Storer.It Ar SS 128*71d1d39eSZachary StorerThe second of the minute, from 0 to 61. 129*71d1d39eSZachary Storer.El 130*71d1d39eSZachary Storer.Pp 131*71d1d39eSZachary StorerIf the 132*71d1d39eSZachary Storer.Dq CC 133*71d1d39eSZachary Storerand 134*71d1d39eSZachary Storer.Dq YY 135*71d1d39eSZachary Storerletter pairs are not specified, the values default to the current 136*71d1d39eSZachary Storeryear. 137*71d1d39eSZachary StorerIf the 138*71d1d39eSZachary Storer.Dq SS 139*71d1d39eSZachary Storerletter pair is not specified, the value defaults to 0. 140*71d1d39eSZachary Storer.El 141*71d1d39eSZachary Storer.Pp 142*71d1d39eSZachary StorerThe 143*71d1d39eSZachary Storer.Fl d , 144*71d1d39eSZachary Storer.Fl r , 145*71d1d39eSZachary Storerand 146*71d1d39eSZachary Storer.Fl t 147*71d1d39eSZachary Storeroptions are mutually exclusive. 148*71d1d39eSZachary StorerIf more than one of these options is present, the last one is used. 149*71d1d39eSZachary Storer.Sh EXIT STATUS 150*71d1d39eSZachary Storer.Ex -std 151*71d1d39eSZachary Storer.Sh COMPATIBILITY 152*71d1d39eSZachary StorerThe obsolescent form of 153*71d1d39eSZachary Storer.Nm , 154*71d1d39eSZachary Storerwhere a time format is specified as the first argument, is supported. 155*71d1d39eSZachary StorerWhen no 156*71d1d39eSZachary Storer.Fl d , 157*71d1d39eSZachary Storer.Fl r , 158*71d1d39eSZachary Storeror 159*71d1d39eSZachary Storer.Fl t 160*71d1d39eSZachary Storeroption is specified, there are at least two arguments, and the first 161*71d1d39eSZachary Storerargument is a string of digits either eight or ten characters in length, 162*71d1d39eSZachary Storerthe first argument is interpreted as a time specification of the form 163*71d1d39eSZachary Storer.Dq MMDDhhmm[YY] . 164*71d1d39eSZachary Storer.Pp 165*71d1d39eSZachary StorerThe 166*71d1d39eSZachary Storer.Dq MM , 167*71d1d39eSZachary Storer.Dq DD , 168*71d1d39eSZachary Storer.Dq hh 169*71d1d39eSZachary Storerand 170*71d1d39eSZachary Storer.Dq mm 171*71d1d39eSZachary Storerletter pairs are treated as their counterparts specified to the 172*71d1d39eSZachary Storer.Fl t 173*71d1d39eSZachary Storeroption. 174*71d1d39eSZachary StorerIf the 175*71d1d39eSZachary Storer.Dq YY 176*71d1d39eSZachary Storerletter pair is in the range 69 to 99, the year is set to 1969 to 1999, 177*71d1d39eSZachary Storerotherwise, the year is set in the 21st century. 178*71d1d39eSZachary Storer.Sh SEE ALSO 179*71d1d39eSZachary Storer.Xr utimes 2 180*71d1d39eSZachary Storer.Sh STANDARDS 181*71d1d39eSZachary StorerThe 182*71d1d39eSZachary Storer.Nm 183*71d1d39eSZachary Storerutility is expected to be a superset of the 184*71d1d39eSZachary Storer.St -p1003.2 185*71d1d39eSZachary Storerspecification. 186*71d1d39eSZachary Storer.Sh HISTORY 187*71d1d39eSZachary StorerA 188*71d1d39eSZachary Storer.Nm 189*71d1d39eSZachary Storerutility appeared in 190*71d1d39eSZachary Storer.At v7 . 191*71d1d39eSZachary Storer.Sh BUGS 192*71d1d39eSZachary StorerA symbolic link can't be a reference file of access and/or modification time. 193