Name
touch — stdin stdout - file -- opt --help --version
Synopsis
touch [options]files
The touch command changes
two timestamps associated with a file: its modification time (when
the file’s data was last changed) and its access time (when the file
was last read). To set both timestamps to right now, run:
$ touch myfile
You can set these timestamps to arbitrary values, e.g.:
$ touch -d "November 18 1975" myfile
If a given file doesn’t exist, touch creates it, a handy way to create
empty files.
Useful options
|
|
Change the access time only. |
|
|
Change the modification time only. |
|
|
If the file doesn’t
exist, don’t create it (normally, |
|
|
Set the file’s
timestamp(s). A tremendous number of timestamp formats are
acceptable, from “12/28/2001 3pm” to “28-May” (the current
year is assumed, and a time of midnight) to “next tuesday
13:59” to “0” (midnight today). Experiment and check your
work with |
|
|
A less intelligent
way to set the file’s |
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