Skip to content

touch

Touch is used to create, change and modify timestamps of a file.

Bash
touch file1 file2 file3
  • Create multiple files from file1.txt to file5.txt
Bash
touch file{1..5}.txt

Some points:

touch -a command changes access time of the file

touch -c command is used to check whether a file is created or not (doesn't create new)

touch -c-d is used to update access and modification time

touch -m is used to change the modification time and it only updates last modification time

touch -r second_file_name first_file_name is used to use the timestamp of another file

touch -t is used to create a file using a specified time