cmdxray / commands / touch

What does touch do?

create empty files, or update a file's access/modification times.

▸ Explain your own touch command →

touch examples, explained

$ touch newfile.txt

  • touchcreate empty files, or update a file's access/modification times
  • newfile.txtan argument passed to the command

$ touch -c -m existing.log

  • touchcreate empty files, or update a file's access/modification times
  • -cdon't create the file if it doesn't already exist
  • -mchange only the modification time
  • existing.logan argument passed to the command

touch flags & options

-achange only the access time
-mchange only the modification time
-cdon't create the file if it doesn't already exist
-ruse this reference file's timestamps instead of now
-dset the time from a human-readable date string
-tset the time from a [[CC]YY]MMDDhhmm[.ss] stamp

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.