logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

touch.1.in (2041B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd 2023-06-03
  5. .Dt TOUCH 1
  6. .Os
  7. .Sh NAME
  8. .Nm touch
  9. .Nd change file access and modification times
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl acfhm
  13. .Op Fl d Ar datetime | Fl t Ar timestamp | Fl r Ar ref_file
  14. .Ar file...
  15. .Sh DESCRIPTION
  16. .Nm
  17. changes the date modification and access times on each
  18. .Ar file
  19. it is given.
  20. .Sh OPTIONS
  21. .Bl -tag -width Ds
  22. .It Fl a
  23. Change the access time, no changes to modification time unless
  24. .Fl m
  25. is also given.
  26. .It Fl c
  27. Do not create
  28. .Ar file .
  29. .It Fl f
  30. Ignored.
  31. coreutils and BusyBox never supported it,
  32. .Ox
  33. removed it in 2005,
  34. .Nx
  35. in 2011,
  36. .Fx
  37. in 2012.
  38. .\" Let's not publicly document too much that illumos still supports it
  39. .It Fl d Ar datetime
  40. Use
  41. .Ar datetime
  42. instead of current time, see
  43. .Sx DATETIME FORMAT
  44. section for more details.
  45. .It Fl h
  46. Do not follow symlinks.
  47. .It Fl m
  48. Change the modification time, no changes to access time unless
  49. .Fl a
  50. is also given.
  51. .It Fl t Ar timestamp
  52. Use the specified
  53. .Ar timestamp
  54. instead of the current time, with the form
  55. .Oo Oo CC Oc Ns YY Oc Ns MMDDhhmm Ns Oo \.SS Oc
  56. where:
  57. .Bl -tag -width _MMDDhhmm_
  58. .It Ql CC
  59. Corresponds to the first 2 digits of the year, aka %C
  60. .It Ql YY
  61. Corresponds to the last 2 digits of the year, aka %y
  62. .It Ql MMDDhhmm
  63. Corresponds to month, day, hours, minutes aka %m%d%H%M
  64. .It Ql .SS
  65. Corresponds to the seconds
  66. .El
  67. .Pp
  68. For example:
  69. .Ql 200306021337.42
  70. .It Fl r Ar ref_file
  71. Use the corresponding times of the file at
  72. .Ar ref_file
  73. instead of the current time.
  74. .El
  75. .Sh DATETIME FORMAT
  76. include(libutils/datetime_parse.mdoc)
  77. .Sh EXIT STATUS
  78. .Ex -std
  79. Note: Will exit with failure when
  80. .Fl c
  81. is given but the file doesn't exists.
  82. .Sh SEE ALSO
  83. .Xr stat 1 ,
  84. .Xr futimens 3 ,
  85. .Xr strptime 3
  86. .Sh STANDARDS
  87. .Nm
  88. should be compliant with the
  89. IEEE Std 1003.1-2024 (“POSIX.1”)
  90. specification.
  91. .Pp
  92. .Fl h
  93. and
  94. .Fl f
  95. are extensions.
  96. .Sh AUTHORS
  97. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me