Touch
|
From Linuxconfig.org
.. back to the list of Linux Commands
Name
touch - change file timestamps
Synopsis - man page
touch [OPTION]... FILE...
Frequently used options
-a change only the access time
-m change only the modification time
-t STAMP
use [[CC]YY]MMDDhhmm[.ss] instead of current time
Examples
touch command enables us to change access and modification time for a given files. Also touch command can be use to create files. Lets create file named touchfile.txt:
$ touch touchfile.txt
To investigate more about this file we can use stat command.
$ stat touchfile.txt
now we can use touch command to change access and modification time to current time:
$ touch touchfile.txt
To change only modification time we can use -m option:
$ touch -m touchfile.txt
Or if we want to change just access time we use -a option
$ touch -a touchfile.txt
Now lets say that we would like to change access and modification time back to 29 January 2005 13:45.45
$ touch -t 200501291345.45 touchfile.txt




















