Thursday, July 26, 2007

How to change the timestamp of a file



I ran in to this problem when moving log files around that the timestamp on some of the files changed. And just for consistence I wanted to change the timestamp of these files..

I found that you can specify the data using the touch command, like this:

[heimdull@hostname ~]# touch -t 200709280930 httpd.conf
[heimdull@hostname ~]# ll httpd.conf
-rw-r–r– 1 root root 1558 Sep 28 2007 httpd.conf
[heimdull@hostname ~]#

If you don’t want to change all the timestamps of the file use these options:
-a change only the access time
-m change only the modification time

View the access timestamp(last time the file was accessed)

ls -ul httpd.conf

View the modification time(Last time the files was changed)

ls -tl httpd.conf

No comments: