touch flags & options

Default usage

Create a new empty file or update an existing file's timestamps to now.

touch newfile.txt
touch file1.txt file2.txt file3.txt

-a

Change only the access time.

touch -a file.txt

-m

Change only the modification time.

touch -m file.txt

-t

Set a specific timestamp in [[CC]YY]MMDDhhmm[.ss] format.

touch -t 202301151230 file.txt
touch -t 202512312359.59 file.txt

-r, --reference

Use another file's timestamps instead of the current time.

touch -r source.txt target.txt

-c, --no-create

Do not create the file if it does not exist.

touch -c maybe-exists.txt