LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 09-11-2014, 04:12 AM   #1
RHCE_ran
Member
 
Registered: Oct 2013
Posts: 90

Rep: Reputation: Disabled
How to find creation date of a file in RHEL 5


We have instances having RHEL 5.10 in our setup. The file system type shown using

df –T

says that file system type is ext3. The ls –ltr command seems to show the modification time but not created date.

I hope my question is clear on how to find the created date of a file in Red Hat Linux.

Requesting a reply to my query.

Regards
 
Old 09-11-2014, 04:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
"stat <filename>" shows you all the relevant timestamps tracked with the file.
 
Old 09-11-2014, 06:45 AM   #3
RHCE_ran
Member
 
Registered: Oct 2013
Posts: 90

Original Poster
Rep: Reputation: Disabled
Thanks for your reply. I did few operations on a sample file,

$ cat > 2 (I created a sample file)
hi
$ stat 2
File: `2'
Size: 3 Blocks: 16 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 98313 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 502/crestelonm) Gid: ( 504/crestelonm)
Access: 2014-09-11 16:06:51.000000000 +0530
Modify: 2014-09-11 16:06:54.000000000 +0530
Change: 2014-09-11 16:06:54.000000000 +0530

$ vim 2 (I edited the file,2)
$ cat 2
hi hello
$ stat 2
File: `2'
Size: 9 Blocks: 16 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 98313 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 502/crestelonm) Gid: ( 504/crestelonm)
Access: 2014-09-11 16:07:51.000000000 +0530
Modify: 2014-09-11 16:08:00.000000000 +0530
Change: 2014-09-11 16:08:00.000000000 +0530

As you can see above that the initial time while creating the file which is 16:06:51.000000000 is not shown after I edited the file.

Requesting a reply so that there is clarity on how to get created date of a file.

Regards
 
Old 09-12-2014, 01:23 AM   #4
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi,

What you are seeing is everything that is tradiotionally tracked for an inode (access, file modification & inode change). Unfortunately creation time is not tracked on ext3 filesystems.

In modern Linux filesystems, such as ext4, Btrfs and JFS there is a new "birth" time attribute in the inode - the moment when it was created on the file system. They use different names for the attribute, though - t is also known as "crtime", "otime" or "btime".

The POSIX stat() function hasn't been updated to return this information, so tools that display inode information are still catching up, and many don't show this info even on ext4.One tool that does show this info is debugfs:

Code:
sudo debugfs -R 'stat /home/osku/foo/foo' /dev/sda7
Here you can find a discussion regarding the stat command and the specific output you're seeing.

OS X's HFS and Microsoft's NTFS also both track the birth time, and I'm told the OS X and Cygwin versions of stat() return this information.

Additional information is availble in this discussion.
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File creation date Jay5487 Linux - Newbie 2 03-25-2008 07:47 AM
file creation date prashantbhushan Linux - General 2 05-29-2007 08:32 AM
File Creation Date in linux jayukanna General 5 08-21-2006 07:08 AM
ls -al file creation date blackzone Linux - Newbie 2 08-23-2004 01:31 AM
creation date of file using the 'ls' command robt Linux - Newbie 1 03-27-2003 12:34 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 02:26 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration