1.\" Copyright (c) 1991 Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Institute of Electrical and Electronics Engineers, Inc. 6.\" 7.\" %sccs.include.redist.man% 8.\" 9.\" @(#)touch.1 6.5 (Berkeley) 03/06/93 10.\" 11.Dd 12.Dt TOUCH 1 13.Os 14.Sh NAME 15.Nm touch 16.Nd change file access and modification times 17.Sh SYNOPSIS 18.Nm touch 19.Op Fl acfm 20.Op Fl r Ar file 21.Op Fl t [[CC]YY]MMDDhhmm[.SS] 22.Ar file ... 23.Sh DESCRIPTION 24The 25.Nm touch 26utility sets the modification and access times of files to the 27current time of day. 28If the file doesn't exist, it is created with default permissions. 29.Pp 30The following options are available: 31.Bl -tag -width Ds 32.It Fl a 33Change the access time of the file. 34The modification time of the file is not changed unless the 35.Fl m 36flag is also specified. 37.It Fl c 38Do not create the file if it does not exist. 39The 40.Nm touch 41utility does not treat this as an error. 42No error messages are displayed and the exit value is not affected. 43.It Fl f 44Attempt to force the update, even if the file permissions do not 45currently permit it. 46.It Fl m 47Change the modification time of the file. 48The access time of the file is not changed unless the 49.Fl a 50flag is also specified. 51.It Fl r 52Use the access and modifications times from the specified file 53instead of the current time of day. 54.It Fl t 55Change the access and modification times to the specified time. 56The argument should be in the form 57.Dq [[CC]YY]MMDDhhmm[.SS] 58where each pair of letters represents the following: 59.Pp 60.Bl -tag -width Ds -compact -offset indent 61.It Ar CC 62The first two digits of the year (the century). 63.It Ar YY 64The second two digits of the year. 65If 66.Dq YY 67is specified, but 68.Dq CC 69is not, a value for 70.Dq YY 71between 69 and 99 results in a 72.Dq YY 73value of 19. 74Otherwise, a 75.Dq YY 76value of 20 is used. 77.It Ar MM 78The month of the year, from 1 to 12. 79.It Ar DD 80the day of the month, from 1 to 31. 81.It Ar hh 82The hour of the day, from 0 to 23. 83.It Ar mm 84The minute of the hour, from 0 to 59. 85.It Ar SS 86The second of the minute, from 0 to 61. 87.El 88.Pp 89If the 90.Dq CC 91and 92.Dq YY 93letter pairs are not specified, the values default to the current 94year. 95If the 96.Dq SS 97letter pair is not specified, the value defaults to 0. 98.El 99.Pp 100The 101.Nm touch 102utility exits 0 on success, and >0 if an error occurs. 103.Sh SEE ALSO 104.Xr utimes 2 105.Sh COMPATIBILITY 106The obsolescent form of 107.Nm touch , 108where a time format is specified as the first argument, is supported. 109When no 110.Fl r 111or 112.Fl t 113option is specified, there are at least two arguments, and the first 114argument is a string of digits either eight or ten characters in length, 115the first argument is interprested as a time specification of the form 116.Dq MMDDhhmm[YY] . 117.Pp 118The 119.Dq MM , 120.Dq DD , 121.Dq hh 122and 123.Dq mm 124letter pairs are treated as their counterparts specified to the 125.Fl t 126option. 127If the 128.Dq YY 129letter pair is in the range 69 to 99, the year is set to 1969 to 1999, 130otherwise, the year is set in the 21st century. 131.Sh HISTORY 132A 133.Nm touch 134command appeared in 135.At v7 . 136.Sh STANDARDS 137The 138.Nm touch 139function is expected to be a superset of the 140.St -p1003.2 141specification. 142