LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-18-2010, 11:27 AM   #1
Trio3b
Member
 
Registered: Oct 2004
Location: Texas, USA
Distribution: MDV 2008.1, PCLinuxOS,
Posts: 315

Rep: Reputation: 30
are linux date/time stamps correct?


read wiki on inode structure for timestamps but not understand.also have read many threads but most are about daylight saving time or timestamps over samba server etc. I just want to know if file creation dates on my desktop PC are correct.

Mandriva / pclos timestamps don't seem to be correct. first why is there no creation date- only modified and accessed? i guess the access date is the creation date?

Sometimes when I modify a file it doesn't reflect the new date.

Is this a problem in linux / the application used or both.I cannot ask office help to be using CL "touch" or other commands to check or modify timestamps. We need to rely on GUI information.

Any help thank you
 
Old 11-18-2010, 11:39 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Linux and UNIX file systems do not store the file creation date and time. They store the date/time that the file was last modified, altered, accessed.
Code:
$ stat bookmarks.html
  File: `bookmarks.html'
  Size: 755856    	Blocks: 1488       IO Block: 4096   regular file
Device: fb00h/64256d	Inode: 3047711     Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/  user1)   Gid: ( 1000/  user1)
Access: 2010-11-18 11:36:10.000000000 -0500
Modify: 2010-10-26 18:17:32.000000000 -0400
Change: 2010-10-26 18:17:32.000000000 -0400

$ ls -lh bookmarks.html
-rw------- 1 user1 user1 739K 2010-10-26 18:17 bookmarks.html

$ chmod a+rwx bookmarks.html
$ stat bookmarks.html
  File: `bookmarks.html'
  Size: 755856    	Blocks: 1488       IO Block: 4096   regular file
Device: fb00h/64256d	Inode: 3047711     Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/  user1)   Gid: ( 1000/  user1)
Access: 2010-11-18 11:36:10.000000000 -0500
Modify: 2010-10-26 18:17:32.000000000 -0400
Change: 2010-11-18 11:40:52.000000000 -0500

$ ls -lh bookmarks.html
-rwxrwxrwx 1 user1 user1 739K 2010-10-26 18:17 bookmarks.html
For future readers I'm doing this on (approximately) 2010-11-18 11:40.

Notice the changes to the different dates. I originally read the file using Firefox just before I performed the stat. That updated the Access record of the file. Then I changed the permissions on the file before the second stat. That updated the Change record of the file. If I changed the contents of the file then the Modify record would have been updated.

Both of the "ls" listings show the date unchanged. That tells us that "ls" shows the modification date.

Last edited by stress_junkie; 11-18-2010 at 11:55 AM.
 
Old 11-18-2010, 12:15 PM   #3
Trio3b
Member
 
Registered: Oct 2004
Location: Texas, USA
Distribution: MDV 2008.1, PCLinuxOS,
Posts: 315

Original Poster
Rep: Reputation: 30
time / date stamps

Quote:
Originally Posted by stress_junkie View Post
Linux and UNIX file systems do not store the file creation date and time. They store the date/time that the file was last modified, altered, accessed.
Code:
$ stat bookmarks.html
  File: `bookmarks.html'
  Size: 755856    	Blocks: 1488       IO Block: 4096   regular file
Device: fb00h/64256d	Inode: 3047711     Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/  user1)   Gid: ( 1000/  user1)
Access: 2010-11-18 11:36:10.000000000 -0500
Modify: 2010-10-26 18:17:32.000000000 -0400
Change: 2010-10-26 18:17:32.000000000 -0400

$ ls -lh bookmarks.html
-rw------- 1 user1 user1 739K 2010-10-26 18:17 bookmarks.html

$ chmod a+rwx bookmarks.html
$ stat bookmarks.html
  File: `bookmarks.html'
  Size: 755856    	Blocks: 1488       IO Block: 4096   regular file
Device: fb00h/64256d	Inode: 3047711     Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/  user1)   Gid: ( 1000/  user1)
Access: 2010-11-18 11:36:10.000000000 -0500
Modify: 2010-10-26 18:17:32.000000000 -0400
Change: 2010-11-18 11:40:52.000000000 -0500

$ ls -lh bookmarks.html
-rwxrwxrwx 1 user1 user1 739K 2010-10-26 18:17 bookmarks.html
For future readers I'm doing this on (approximately) 2010-11-18 11:40.

Notice the changes to the different dates. I originally read the file using Firefox just before I performed the stat. That updated the Access record of the file. Then I changed the permissions on the file before the second stat. That updated the Change record of the file. If I changed the contents of the file then the Modify record would have been updated.

Both of the "ls" listings show the date unchanged. That tells us that "ls" shows the modification date.

How would I do this for hundreds of business files? I just created a text file then waited 15 min and modified it. The new mod and access time is updated to new time. stat also shows updated times.

How to know / preserve creation date of a particular file in linux? This is important to know.

Thanks
 
Old 11-18-2010, 12:31 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by Trio3b View Post
How would I do this for hundreds of business files? I just created a text file then waited 15 min and modified it. The new mod and access time is updated to new time. stat also shows updated times.
If you want to list the data that I showed you then you could use the find command.
Code:
find . -type f -exec stat {} \;
You could store all of that information in a file like this.
Code:
find . -type f -exec stat {} \; >file-status-data.txt
=============

Quote:
Originally Posted by Trio3b View Post
How to know / preserve creation date of a particular file in linux? This is important to know.
You would have to keep your own listing of creation dates for the files. I don't know how you could easily automate that. You would have to add some module to the kernel to intercept file creation and make a record somewhere in your own database.

Basically I'm saying it isn't practical.

Last edited by stress_junkie; 11-18-2010 at 12:39 PM.
 
Old 11-18-2010, 12:49 PM   #5
Trio3b
Member
 
Registered: Oct 2004
Location: Texas, USA
Distribution: MDV 2008.1, PCLinuxOS,
Posts: 315

Original Poster
Rep: Reputation: 30
Easy solution would be to just add date to filename such as: 111810<filename> for nov 18th 2010<filename>

What was reasoning behind not importance for file creation date in linux kernel? Just curious

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
syslog time wrong - but date returns the correct time? falc410 Linux - Newbie 5 11-09-2013 05:54 AM
[SOLVED] move file and folder date stamps smithy2010 Linux - Newbie 3 05-08-2010 11:52 AM
LXer: Using Perl On Linux To Do Mass Synchronization Of File Time Stamps LXer Syndicated Linux News 0 05-27-2008 08:41 AM
Time stamps following move to British Summer Time aikempshall Linux - General 2 03-30-2007 09:30 AM
time and date not correct, after reboot vasanthraghavan Linux - General 4 03-10-2005 12:55 PM


All times are GMT -5. The time now is 06:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration