What are other touch options?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 03 2025
0117

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

  1. -a: Update the access time only, without changing the modification time.

    touch -a filename.txt
  2. -m: Update the modification time only, without changing the access time.

    touch -m filename.txt
  3. -c: Do not create a new file if it does not exist. This option prevents touch from creating an empty file.

    touch -c filename.txt
  4. -d: Set the date and time to a specific value instead of the current time. You can specify the date in various formats.

    touch -d "2023-01-01 12:00:00" filename.txt
  5. -t: Set the date and time using a specific format (e.g., [[CC]YY]MMDDhhmm[.ss]).

    touch -t 202301011200.00 filename.txt
  6. --help: Display help information about the touch command and its options.

    touch --help

If you have any more questions or need further clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!