Name
touch [options
] files
— coreutils
Synopsis
/bin
stdin stdout - file -- opt --help --version
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).
$ 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 |
Get Linux Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.