Linux/Unix – Managing Files…
File management tools include those for splitting, comparing, and compressing files, making backup archives, and tracking file revisions. Other management tools exist for determining the contents of a file, and for changing its timestamp.
Changing File Modification Time
Use touch to change a file’s timestamp without modifying its contents. Give the name of the file to be
changed as an argument. The default action is to change the timestamp to the current time.
To change the timestamp of file `pizzicato’ to the current date and time, type:
$ touch pizzicato
To specify a timestamp other than the current system time, use the `−d’ option, followed by the date and time that should be used enclosed in quote characters. You can specify just the date, just the time, or both.
To change the timestamp of file `pizzicato’ to `17 May 1999 14:16′, type:
$ touch −d ’17 May 1999 14:16′ pizzicato
To change the timestamp of file `pizzicato’ to `14 May’, type:
$ touch −d ’14 May’ pizzicato
To change the timestamp of file `pizzicato’ to `14:16′, type:
$ touch −d ’14:16′ pizzicato
NOTE: When only the date is given, the time is set to `0:00′; when no year is given, the current year is used. See Info file `fileutils.info’, node `Date input formats’, for more information on date input formats.