|How to manipulate or change the last modified/accessed time of a
file using touch command?
Assume there’s a file @ /home/user/testmsg.txt
# Only change the last modified time
# Change both the times - modified and accessed times
touch is a standard Unix program used to change a file‘s access and modification timestamps. It is also used to create a new empty file.
touch [-a] [-c] [-m] [-r ref_file | -t time ] file
settime [ -f ref_file ] file
-a -> Change the access time of file. Do not change the modification time unless -m is also specified.
-c -> Do not create a specified file if it does not exist. Do not write any diagnostic messages concerning this condition.
-m -> Change the modification time of file. Do not change the access time unless -a is also specified.
-r ref_file -> Use the corresponding times of the file named by ref_file instead of the current time.
-t time ->
Use the specified time instead of the current time. time will be a decimal number of the form:
MM - The month of the year [01-12].
file -> A path name of a file whose times are to be modified.
Have a Unix Problem
Return to : - Unix System Administration Hints and Tips
(c) www.gotothings.com All material on this site is