touch.1 (3375B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2023-06-03
- .Dt TOUCH 1
- .Os
- .Sh NAME
- .Nm touch
- .Nd change file access and modification times
- .Sh SYNOPSIS
- .Nm
- .Op Fl acfhm
- .Op Fl d Ar datetime | Fl t Ar timestamp | Fl r Ar ref_file
- .Ar file...
- .Sh DESCRIPTION
- .Nm
- changes the date modification and access times on each
- .Ar file
- it is given.
- .Sh OPTIONS
- .Bl -tag -width Ds
- .It Fl a
- Change the access time, no changes to modification time unless
- .Fl m
- is also given.
- .It Fl c
- Do not create
- .Ar file .
- .It Fl f
- Ignored.
- coreutils and BusyBox never supported it,
- .Ox
- removed it in 2005,
- .Nx
- in 2011,
- .Fx
- in 2012.
- .\" Let's not publicly document too much that illumos still supports it
- .It Fl d Ar datetime
- Use
- .Ar datetime
- instead of current time, see
- .Sx DATETIME FORMAT
- section for more details.
- .It Fl h
- Do not follow symlinks.
- .It Fl m
- Change the modification time, no changes to access time unless
- .Fl a
- is also given.
- .It Fl t Ar timestamp
- Use the specified
- .Ar timestamp
- instead of the current time, with the form
- .Oo Oo CC Oc Ns YY Oc Ns MMDDhhmm Ns Oo \.SS Oc
- where:
- .Bl -tag -width _MMDDhhmm_
- .It Ql CC
- Corresponds to the first 2 digits of the year, aka %C
- .It Ql YY
- Corresponds to the last 2 digits of the year, aka %y
- .It Ql MMDDhhmm
- Corresponds to month, day, hours, minutes aka %m%d%H%M
- .It Ql .SS
- Corresponds to the seconds
- .El
- .Pp
- For example:
- .Ql 200306021337.42
- .It Fl r Ar ref_file
- Use the corresponding times of the file at
- .Ar ref_file
- instead of the current time.
- .El
- .Sh DATETIME FORMAT
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .\"
- Multiple different but unambiguous formats are supported:
- @epoch, Email, asctime, RFC3339.
- .Ss @epoch
- Leading @ (at) symbol followed by
- the Unix timestamp (number of seconds before and after 1970-01-01 00:00:00Z),
- for example
- .Ql @1698791420
- corresponds to 2023-10-31 23:30:20 UTC
- .Ss Email
- Also known as "Internet Message Format" (RFC5322, RFC2822, RFC822), for example:
- .Bl -bullet -compact
- .It
- .Ql Fri, 21 Nov 1997 09:55:06 -0600
- .It
- .Ql 21 Nov 97 09:55:06 GMT
- .El
- .Ss asctime
- Output format of
- .Xr asctime 3 ,
- for example:
- .Ql Sun Sep 16 01:03:52 1973
- .Ss RFC3339
- Profile of ISO\ 8601:1988, found in modern protocols and file formats.
- Formatted as
- .Ql YYYY-MM-DDThh:mm:SS[frac][tz] ,
- where:
- .Bl -tag -width Ds
- .It Ql YYYY-MM-DD
- Corresponds to %Y-%m-%d of
- .Xr strptime 3 .
- .It Ql T
- Is either
- .Ql T
- or a space.
- .It Ql [frac]
- Is either empty, or fractional seconds starting with either a comma
- .Pq \&,
- or a period
- .Pq \&. .
- .It Ql [tz]
- When empty it corresponds to local time.
- Otherwise it can be an UTC offset in the format
- .Ql [+-]HH:?MM
- or the letter
- .Qq Z ,
- signifying UTC.
- .El
- .Pp
- Some examples:
- .Bl -bullet -compact
- .It
- .Ql 2003-06-02T13:37:42.713Z
- .It
- .Ql 1971-01-02T03:04:05.678+0900
- .El
- .Sh EXIT STATUS
- .Ex -std
- Note: Will exit with failure when
- .Fl c
- is given but the file doesn't exists.
- .Sh SEE ALSO
- .Xr stat 1 ,
- .Xr futimens 3 ,
- .Xr strptime 3
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .Pp
- .Fl h
- and
- .Fl f
- are extensions.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me