Annotation of src/usr.bin/touch/touch.1, Revision 1.18
1.18 ! guenther 1: .\" $OpenBSD: touch.1,v 1.17 2010/09/03 11:09:29 jmc Exp $
1.1 deraadt 2: .\" $NetBSD: touch.1,v 1.8 1995/08/31 22:10:05 jtc Exp $
3: .\"
4: .\" Copyright (c) 1991, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" the Institute of Electrical and Electronics Engineers, Inc.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
1.8 millert 18: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" @(#)touch.1 8.3 (Berkeley) 4/28/95
35: .\"
1.18 ! guenther 36: .Dd $Mdocdate: September 3 2010 $
1.1 deraadt 37: .Dt TOUCH 1
38: .Os
39: .Sh NAME
40: .Nm touch
41: .Nd change file access and modification times
42: .Sh SYNOPSIS
43: .Nm touch
1.10 otto 44: .Op Fl acm
1.18 ! guenther 45: .Op Fl d Ar YYYY-MM-DDThh:mm:SS[.frac][Z]
1.1 deraadt 46: .Op Fl r Ar file
47: .Op Fl t Ar [[CC]YY]MMDDhhmm[.SS]
1.14 sobrado 48: .Ar
1.1 deraadt 49: .Sh DESCRIPTION
50: The
1.5 aaron 51: .Nm
1.1 deraadt 52: utility sets the modification and access times of files to the
53: current time of day.
54: If the file doesn't exist, it is created with default permissions.
55: .Pp
1.4 aaron 56: The options are as follows:
1.1 deraadt 57: .Bl -tag -width Ds
58: .It Fl a
59: Change the access time of the file.
60: The modification time of the file is not changed unless the
61: .Fl m
62: flag is also specified.
63: .It Fl c
64: Do not create the file if it does not exist.
65: The
1.5 aaron 66: .Nm
1.1 deraadt 67: utility does not treat this as an error.
68: No error messages are displayed and the exit value is not affected.
1.18 ! guenther 69: .It Fl d Ar YYYY-MM-DDThh:mm:SS[.frac][Z]
! 70: Change the access and modification times to the specified time.
! 71: The argument should be in the form
! 72: .Dq YYYY-MM-DDThh:mm:SS[.frac][Z]
! 73: where the parts of the argument represent the following:
! 74: .Pp
! 75: .Bl -tag -width .frac -compact -offset indent
! 76: .It Ar YYYY
! 77: The four digits of the year.
! 78: .It Ar MM
! 79: The month of the year, from 1 to 12.
! 80: .It Ar DD
! 81: The day of the month, from 1 to 31.
! 82: .It Ar T
! 83: Either the capital letter
! 84: .Sq T
! 85: or a single space.
! 86: .It Ar hh
! 87: The hour of the day, from 0 to 23.
! 88: .It Ar mm
! 89: The minute of the hour, from 0 to 59.
! 90: .It Ar SS
! 91: The second of the minute, from 0 to 60.
! 92: .It Ar .frac
! 93: The decimal fraction of the second, either a period or comma, followed
! 94: by one or more decimal digits.
! 95: .It Ar Z
! 96: The timezone specifier, a capital letter
! 97: .Sq Z
! 98: indicating that the time is in UTC.
! 99: If not specified, the time is in the local timezone.
! 100: .El
1.1 deraadt 101: .It Fl m
102: Change the modification time of the file.
103: The access time of the file is not changed unless the
104: .Fl a
105: flag is also specified.
1.11 jmc 106: .It Fl r Ar file
1.7 henning 107: Use the access and modification times from the specified file
1.1 deraadt 108: instead of the current time of day.
1.11 jmc 109: .It Fl t Ar [[CC]YY]MMDDhhmm[.SS]
1.1 deraadt 110: Change the access and modification times to the specified time.
111: The argument should be in the form
112: .Dq [[CC]YY]MMDDhhmm[.SS]
113: where each pair of letters represents the following:
114: .Pp
115: .Bl -tag -width Ds -compact -offset indent
116: .It Ar CC
117: The first two digits of the year (the century).
118: .It Ar YY
119: The second two digits of the year.
120: If
121: .Dq YY
122: is specified, but
123: .Dq CC
124: is not, a value for
125: .Dq YY
126: between 69 and 99 results in a
127: .Dq CC
128: value of 19.
129: Otherwise, a
130: .Dq CC
131: value of 20 is used.
132: .It Ar MM
133: The month of the year, from 1 to 12.
134: .It Ar DD
1.3 aaron 135: The day of the month, from 1 to 31.
1.1 deraadt 136: .It Ar hh
137: The hour of the day, from 0 to 23.
138: .It Ar mm
139: The minute of the hour, from 0 to 59.
140: .It Ar SS
1.18 ! guenther 141: The second of the minute, from 0 to 60.
1.1 deraadt 142: .El
143: .Pp
144: If the
145: .Dq CC
146: and
147: .Dq YY
148: letter pairs are not specified, the values default to the current
149: year.
150: If the
151: .Dq SS
152: letter pair is not specified, the value defaults to 0.
153: .El
1.17 jmc 154: .Sh EXIT STATUS
1.15 sobrado 155: .Ex -std touch
1.1 deraadt 156: .Sh SEE ALSO
157: .Xr utimes 2
1.9 jmc 158: .Sh STANDARDS
1.12 jmc 159: The
160: .Nm
161: utility is compliant with the
1.16 jmc 162: .St -p1003.1-2008
1.12 jmc 163: specification.
164: .Pp
1.1 deraadt 165: The obsolescent form of
166: .Nm touch ,
167: where a time format is specified as the first argument, is supported.
168: When no
169: .Fl r
170: or
171: .Fl t
172: option is specified, there are at least two arguments, and the first
173: argument is a string of digits either eight or ten characters in length,
174: the first argument is interpreted as a time specification of the form
175: .Dq MMDDhhmm[YY] .
176: .Pp
177: The
178: .Dq MM ,
179: .Dq DD ,
180: .Dq hh
181: and
182: .Dq mm
183: letter pairs are treated as their counterparts specified to the
184: .Fl t
185: option.
186: If the
187: .Dq YY
1.6 pjanzen 188: letter pair is in the range 69 to 99, the year is set from 1969 to 1999;
1.1 deraadt 189: otherwise, the year is set in the 21st century.
1.5 aaron 190: .Sh HISTORY
191: A
192: .Nm
193: utility appeared in
1.6 pjanzen 194: .At v7 .