logo

utils-std

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

touch.1.in (1920B)


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