Name
touch
Synopsis
touch [options]files
For one or more files, updates the access
time and modification time (and dates) to the current time and date.
touch is useful in forcing other commands to
handle files a certain way; e.g., the operation of
make, and sometimes find,
relies on a file’s access and modification time. If
a file doesn’t exist, touch
creates it with a file size of 0.
Options
-
-a Update only the access time.
-
-c Don’t create any file that doesn’t already exist.
-
-f Try to update even if you don’t have permissions.
-
-h The access or modification times of a symbolic link are changed. Access and modification time can be changed at the same time. The
-coption is also applied.-
-m Update only the modification time.
-
-rfile Change times to be the same as those of the specified
file, instead of the current time.-
-ttime Use the time specified in
timeinstead of the current time. This argument must be of the format:[[cc]yy]mmddhhmm[.ss], indicating optional century and year, month, date, hours, minutes, and optional seconds.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access