What are other touch command options?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 24 2025
0126

The touch command has several options that can modify its behavior. Here are some commonly used options:

  1. -a: Change only the access time of the file.

    touch -a file1.txt
  2. -m: Change only the modification time of the file.

    touch -m file1.txt
  3. -c: Do not create the file if it does not exist.

    touch -c file1.txt
  4. -d: Set the file's timestamp to a specific date and time.

    touch -d "2023-01-01 12:00:00" file1.txt
  5. -t: Set the file's timestamp using a specific format (e.g., [[CC]YY]MMDDhhmm[.ss]).

    touch -t 202301011200.00 file1.txt
  6. -r: Use the timestamp of another file.

    touch -r reference.txt file1.txt

These options allow you to customize how touch interacts with files. If you need more details or examples, let me know!

0 Comments

no data
Be the first to share your comment!