logo

utils-std

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

touch.1.in (2085B)


  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. and so fail when it doesn't already exists.
  30. .It Fl f
  31. Ignored.
  32. coreutils and BusyBox never supported it,
  33. .Ox
  34. removed it in 2005,
  35. .Nx
  36. in 2011,
  37. .Fx
  38. in 2012.
  39. .\" Let's not publicly document too much that illumos still supports it
  40. .It Fl d Ar datetime
  41. Use
  42. .Ar datetime
  43. instead of current time, see
  44. .Sx DATETIME FORMAT
  45. section for more details.
  46. .It Fl h
  47. Do not follow symlinks.
  48. .It Fl m
  49. Change the modification time, no changes to access time unless
  50. .Fl a
  51. is also given.
  52. .It Fl t Ar timestamp
  53. Use the specified
  54. .Ar timestamp
  55. instead of the current time, with the form
  56. .Oo Oo CC Oc Ns YY Oc Ns MMDDhhmm Ns Oo \.SS Oc
  57. where:
  58. .Bl -tag -width _MMDDhhmm_
  59. .It Ql CC
  60. Corresponds to the first 2 digits of the year, aka %C
  61. .It Ql YY
  62. Corresponds to the last 2 digits of the year, aka %y
  63. .It Ql MMDDhhmm
  64. Corresponds to month, day, hours, minutes aka %m%d%H%M
  65. .It Ql .SS
  66. Corresponds to the seconds
  67. .El
  68. .Pp
  69. For example:
  70. .Ql 200306021337.42
  71. .It Fl r Ar ref_file
  72. Use the corresponding times of the file at
  73. .Ar ref_file
  74. instead of the current time.
  75. .El
  76. .Sh DATETIME FORMAT
  77. include(libutils/datetime_parse.mdoc)
  78. .Sh EXIT STATUS
  79. .Ex -std
  80. Note: Will exit with failure when
  81. .Fl c
  82. is given but the file doesn't exists.
  83. .Sh SEE ALSO
  84. .Xr stat 1 ,
  85. .Xr futimens 3 ,
  86. .Xr strptime 3
  87. .Sh STANDARDS
  88. .Nm
  89. should be compliant with the
  90. IEEE Std 1003.1-2024 (“POSIX.1”)
  91. specification.
  92. .Pp
  93. .Fl h
  94. and
  95. .Fl f
  96. are extensions.
  97. .Sh AUTHORS
  98. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me