1 .\" $OpenBSD: touch.1,v 1.14 2007/08/06 19:16:06 sobrado Exp $
2 .\" $NetBSD: touch.1,v 1.8 1995/08/31 22:10:05 jtc Exp $
4 .\" Copyright (c) 1991, 1993
5 .\" The Regents of the University of California. All rights reserved.
7 .\" This code is derived from software contributed to Berkeley by
8 .\" the Institute of Electrical and Electronics Engineers, Inc.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
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.
18 .\" 3. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
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
34 .\" @(#)touch.1 8.3 (Berkeley) 4/28/95
36 .Dd $Mdocdate: August 6 2007 $
41 .Nd change file access and modification times
46 .Op Fl t Ar [[CC]YY]MMDDhhmm[.SS]
51 utility sets the modification and access times of files to the
53 If the file doesn't exist, it is created with default permissions.
55 The options are as follows:
58 Change the access time of the file.
59 The modification time of the file is not changed unless the
61 flag is also specified.
63 Do not create the file if it does not exist.
66 utility does not treat this as an error.
67 No error messages are displayed and the exit value is not affected.
69 Change the modification time of the file.
70 The access time of the file is not changed unless the
72 flag is also specified.
74 Use the access and modification times from the specified file
75 instead of the current time of day.
76 .It Fl t Ar [[CC]YY]MMDDhhmm[.SS]
77 Change the access and modification times to the specified time.
78 The argument should be in the form
79 .Dq [[CC]YY]MMDDhhmm[.SS]
80 where each pair of letters represents the following:
82 .Bl -tag -width Ds -compact -offset indent
84 The first two digits of the year (the century).
86 The second two digits of the year.
93 between 69 and 99 results in a
100 The month of the year, from 1 to 12.
102 The day of the month, from 1 to 31.
104 The hour of the day, from 0 to 23.
106 The minute of the hour, from 0 to 59.
108 The second of the minute, from 0 to 61.
115 letter pairs are not specified, the values default to the current
119 letter pair is not specified, the value defaults to 0.
124 utility exits 0 on success or >0 if an error occurred.
130 utility is compliant with the
134 The obsolescent form of
136 where a time format is specified as the first argument, is supported.
141 option is specified, there are at least two arguments, and the first
142 argument is a string of digits either eight or ten characters in length,
143 the first argument is interpreted as a time specification of the form
152 letter pairs are treated as their counterparts specified to the
157 letter pair is in the range 69 to 99, the year is set from 1969 to 1999;
158 otherwise, the year is set in the 21st century.