Sodamhan.com

TL;DR

touch

Create files and set access/modification times. More information: https://manned.org/touch.

  • Create specific files:

touch path/to/file1 path/to/file2 ...

  • Set the file access or modification times to the current one and don’t create file if it doesn’t exist:

touch -c -a|m path/to/file1 path/to/file2 ...

  • Set the file time to a specific value and don’t create file if it doesn’t exist:

touch -c -t YYYYMMDDHHMM.SS path/to/file1 path/to/file2 ...

  • Set the files’ timestamp to the reference file’s timestamp, and do not create the file if it does not exist:

touch -c -r path/to/reference_file path/to/file1 path/to/file2 ...

This document was created using the contents of the tldr project.