logo

utils-std

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

touch.1.in (1902B)


  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 h
  41. Do not follow symlinks.
  42. .It Fl m
  43. Change the modification time, no changes to access time unless
  44. .Fl a
  45. is also given.
  46. .It Fl t Ar datetime
  47. Use the specified
  48. .Ar datetime
  49. instead of the current time, with the form
  50. .Oo Oo CC Oc Ns YY Oc Ns MMDDhhmm Ns Oo \.SS Oc
  51. where:
  52. .Bl -tag -width _MMDDhhmm_
  53. .It Ql CC
  54. Corresponds to the first 2 digits of the year, aka %C
  55. .It Ql YY
  56. Corresponds to the last 2 digits of the year, aka %y
  57. .It Ql MMDDhhmm
  58. Corresponds to month, day, hours, minutes aka %m%d%H%M
  59. .It Ql .SS
  60. Corresponds to the seconds
  61. .El
  62. .Pp
  63. For example:
  64. .Ql 200306021337.42
  65. .It Fl r Ar ref_file
  66. Use the corresponding times of the file at
  67. .Ar ref_file
  68. instead of the current time.
  69. .El
  70. .Sh EXIT STATUS
  71. .Ex -std
  72. Note: Will exit with failure when
  73. .Fl c
  74. is given but the file doesn't exists.
  75. .Sh SEE ALSO
  76. .Xr stat 1 ,
  77. .Xr futimens 3 ,
  78. .Xr strptime 3
  79. .Sh STANDARDS
  80. .Nm
  81. should be compliant with the
  82. IEEE Std 1003.1-2024 (“POSIX.1”)
  83. specification.
  84. .Pp
  85. .Fl h
  86. and
  87. .Fl f
  88. are extensions.
  89. .Sh AUTHORS
  90. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me