Hacker News new | ask | show | jobs
by cferr 1588 days ago
If the file does not exist, it creates an empty file. That is what most people use touch for.
1 comments

That's one use case.

The actual use case touch was designed for was to update the timestamp of a file. This is a huge case for developers, since timestamps are used in dependency resolution of partial compilation. [1]

[1] https://man7.org/linux/man-pages/man1/touch.1.html

  NAME
       touch - change file timestamps
  DESCRIPTION
       Update the access and modification times of each FILE to the
       current time.