logo

utils-std

Collection of commonly available Unix tools

touch.1 (1691B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2023 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 achm
  13. .Op Fl d 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 h
  29. Do not follow symlinks.
  30. .It Fl m
  31. Change the modification time, no changes to access time unless
  32. .Fl a
  33. is also given.
  34. .It Fl d Ar datetime
  35. Use the specified
  36. .Ar datetime
  37. instead of the current time.
  38. Should be formatted as
  39. .Ql YYYY-MM-DDThh:mm:SS[frac][Z] ,
  40. where:
  41. .Bl -tag -width Ds
  42. .It Ql YYYY-MM-DD
  43. Corresponds to %Y-%m-%d of
  44. .Xr strptime 3 .
  45. .It Ql T
  46. Is either
  47. .Ql T
  48. or a space.
  49. .It Ql [frac]
  50. Is either empty, or fractional seconds starting with either a comma
  51. .Pq \&,
  52. or a period
  53. .Pq \&. .
  54. .It Ql [Z]
  55. Is either empty, signifying local time, or the letter
  56. .Qq Z ,
  57. signifying UTC.
  58. .El
  59. .Pp
  60. For example:
  61. .Ql 2003-06-02T13:37:42.713Z
  62. .It Fl r Ar ref_file
  63. Use the corresponding times of the file at
  64. .Ar ref_file
  65. instead of the current time.
  66. .El
  67. .Sh EXIT STATUS
  68. .Ex -std
  69. Note: Will exit with failure when
  70. .Fl c
  71. is given but the file doesn't exists.
  72. .Sh SEE ALSO
  73. .Xr stat 1 ,
  74. .Xr futimens 3
  75. .Sh STANDARDS
  76. .Nm
  77. is mostly compliant with the
  78. .St -p1003.1-2008
  79. specification.
  80. .Fl t
  81. is intentionally missing.
  82. .Fl h
  83. is an extension.
  84. .Sh AUTHORS
  85. .An Haelwenn (lanodan) Monnier Aq Mt contact@hacktivis.me