Annotation of src/usr.bin/touch/touch.1, Revision 1.20
1.20 ! jmc 1: .\" $OpenBSD: touch.1,v 1.19 2011/08/20 07:47:10 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.19 jmc 36: .Dd $Mdocdate: August 20 2011 $
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.19 jmc 45: .Sm off
46: .Op Fl "d " Ar YYYY No - Ar MM No - Ar DDThh : Ar mm : Ar SS Oo \&. Ar frac Oc Op Ar Z
47: .Sm on
1.1 deraadt 48: .Op Fl r Ar file
1.19 jmc 49: .Op Fl t Oo Ns Oo Ar CC Oc Ns Ar YY Oc Ns Ar MMDDhhmm Ns Op \&. Ns Ar SS
1.14 sobrado 50: .Ar
1.1 deraadt 51: .Sh DESCRIPTION
52: The
1.5 aaron 53: .Nm
1.1 deraadt 54: utility sets the modification and access times of files to the
55: current time of day.
56: If the file doesn't exist, it is created with default permissions.
57: .Pp
1.4 aaron 58: The options are as follows:
1.1 deraadt 59: .Bl -tag -width Ds
60: .It Fl a
61: Change the access time of the file.
62: The modification time of the file is not changed unless the
63: .Fl m
64: flag is also specified.
65: .It Fl c
66: Do not create the file if it does not exist.
67: The
1.5 aaron 68: .Nm
1.1 deraadt 69: utility does not treat this as an error.
70: No error messages are displayed and the exit value is not affected.
1.19 jmc 71: .Sm off
72: .It Fl "d " Ar YYYY No - Ar MM No - Ar DDThh : Ar mm : Ar SS Oo \&. Ar frac Oc Op Ar Z
73: .Sm on
1.18 guenther 74: Change the access and modification times to the specified time.
1.20 ! jmc 75: The argument should be of the form
! 76: YYYY-MM-DDThh:mm:SS[.frac][Z],
1.18 guenther 77: where the parts of the argument represent the following:
78: .Pp
79: .Bl -tag -width .frac -compact -offset indent
80: .It Ar YYYY
81: The four digits of the year.
82: .It Ar MM
83: The month of the year, from 1 to 12.
84: .It Ar DD
85: The day of the month, from 1 to 31.
86: .It Ar T
87: Either the capital letter
88: .Sq T
89: or a single space.
90: .It Ar hh
91: The hour of the day, from 0 to 23.
92: .It Ar mm
93: The minute of the hour, from 0 to 59.
94: .It Ar SS
95: The second of the minute, from 0 to 60.
96: .It Ar .frac
97: The decimal fraction of the second, either a period or comma, followed
98: by one or more decimal digits.
99: .It Ar Z
100: The timezone specifier, a capital letter
101: .Sq Z
102: indicating that the time is in UTC.
103: If not specified, the time is in the local timezone.
104: .El
1.1 deraadt 105: .It Fl m
106: Change the modification time of the file.
107: The access time of the file is not changed unless the
108: .Fl a
109: flag is also specified.
1.11 jmc 110: .It Fl r Ar file
1.7 henning 111: Use the access and modification times from the specified file
1.1 deraadt 112: instead of the current time of day.
1.19 jmc 113: .It Fl t Oo Ns Oo Ar CC Oc Ns Ar YY Oc Ns Ar MMDDhhmm Ns Op \&. Ns Ar SS
1.1 deraadt 114: Change the access and modification times to the specified time.
1.20 ! jmc 115: The argument should be of the form
! 116: [[CC]YY]MMDDhhmm[.SS],
! 117: where the parts of the argument represent the following:
1.1 deraadt 118: .Pp
119: .Bl -tag -width Ds -compact -offset indent
120: .It Ar CC
121: The first two digits of the year (the century).
122: .It Ar YY
123: The second two digits of the year.
124: If
125: .Dq YY
126: is specified, but
127: .Dq CC
128: is not, a value for
129: .Dq YY
130: between 69 and 99 results in a
131: .Dq CC
132: value of 19.
133: Otherwise, a
134: .Dq CC
135: value of 20 is used.
136: .It Ar MM
137: The month of the year, from 1 to 12.
138: .It Ar DD
1.3 aaron 139: The day of the month, from 1 to 31.
1.1 deraadt 140: .It Ar hh
141: The hour of the day, from 0 to 23.
142: .It Ar mm
143: The minute of the hour, from 0 to 59.
144: .It Ar SS
1.18 guenther 145: The second of the minute, from 0 to 60.
1.1 deraadt 146: .El
147: .Pp
148: If the
149: .Dq CC
150: and
151: .Dq YY
152: letter pairs are not specified, the values default to the current
153: year.
154: If the
155: .Dq SS
156: letter pair is not specified, the value defaults to 0.
157: .El
1.17 jmc 158: .Sh EXIT STATUS
1.15 sobrado 159: .Ex -std touch
1.1 deraadt 160: .Sh SEE ALSO
161: .Xr utimes 2
1.9 jmc 162: .Sh STANDARDS
1.12 jmc 163: The
164: .Nm
165: utility is compliant with the
1.16 jmc 166: .St -p1003.1-2008
1.12 jmc 167: specification.
168: .Pp
1.1 deraadt 169: The obsolescent form of
170: .Nm touch ,
171: where a time format is specified as the first argument, is supported.
172: When no
173: .Fl r
174: or
175: .Fl t
176: option is specified, there are at least two arguments, and the first
177: argument is a string of digits either eight or ten characters in length,
178: the first argument is interpreted as a time specification of the form
179: .Dq MMDDhhmm[YY] .
180: .Pp
181: The
182: .Dq MM ,
183: .Dq DD ,
184: .Dq hh
185: and
186: .Dq mm
187: letter pairs are treated as their counterparts specified to the
188: .Fl t
189: option.
190: If the
191: .Dq YY
1.6 pjanzen 192: letter pair is in the range 69 to 99, the year is set from 1969 to 1999;
1.1 deraadt 193: otherwise, the year is set in the 21st century.
1.5 aaron 194: .Sh HISTORY
195: A
196: .Nm
197: utility appeared in
1.6 pjanzen 198: .At v7 .