BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

How to Change File Timestamp in Linux

We may get a warning from the complile that "make: warning: Clock skew detected. Your build may be incomplete.". That says we need to change the file timestamp to a correct value. There are two methods to accomplish it. I test these samples in Ubuntu 14.04 LTS.

1. Open and resave it

If the file is a simple text or a document with serveral numbers, eg, *.mk, *.doc, *.txt, *.java, *.cpp, etc, you can open and resave it, Linux will update the timestamp automatically.

If it is a binary file or if you have too many files pending to change, even some sub-folders included, you must look forward to some other ways.

2. Using touch to change timestamp

Running these examples in your command prompt.

Example:

Change file sample.mk modified time to 2013-07-20 11:22:03

touch -m -d "2013-07-20 11:22:03" sample.mk

Change file accessed and modified time to 2013-07-20 11:22:03

touch -d "2013-07-20 11:22:03" sample.mk

Change all *.hex files timestamp to current time

touch *.hex

For more information:

touch --help

Related Articles

Comments(0)  

Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.

Subscriptions

  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530