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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: