l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Nov 06 20:44

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] Stat a file's creation time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] Stat a file's creation time

Hookay, maybe I'm trippin' but after reading the man pages for
stat(1), ls, and stat(2), I'm beginning to think that Unix filesystems
don't bother to keep track of the original creation date of a file.
Not that this information has ever been terribly important to me, but
I stumbled into it while I was writing a backup script for a small
Linux server I use here at work.

Actually, it's not even important for me to have this information for
my script.  I just thought I'd look up a few of my file's creation
times out of curiosity while I was writing the script, which happens
to be in perl and I was using the File::stat library.  I quickly
noticed that there didn't seem to be a way to do it via perl's stat
functions, so I tried the stat program.

The stat program lists Access, Modification, and Change times akin to
atime, mtime, and ctime of perl's File::stat module, which are just
tie-ins to stat(2) anyway.  Since I figured I was missing something, I
experimented with the stat program and a text file and concluded.

  * Access time represents the last time the file was open to be read.
  * Modification time represents the last time the file was written to
    in any shape or form.
  * Change time represents the last time any of the file's meta data
    was altered, such as permissions, uid, gid, and size.  It often
    coincides with modification time, because if a file's size is changed,
    the meta data which keeps track of the size has to change to
    represent that.

But someone please correct me if I've misunderstood what each one
means.  Nothing above seems to represent the time that a file was
originally created.  Granted that this isn't a very functionally
important piece of information compared to the modification time of a
file (at least for most purposes), but it seems like it'd be useful to
someone, somewhere.

I ssh'ed into the isun servers and ran the same tests and sure enough
same results, hmm, it's not just a linux-ism, it's a unix-ism.

Tripwire and Integrit keep file integrity databases and I imagine such
information is present in those databases.  However, one would have to
then run these systems and this information would have to be retreived
programatically through provided libraries.  It just seems like this
information would be important for someone to have if they needed it,
and it would therefore be in the best interests of the filesystem to
be keeping track of this information, not to rag on those open source
developers; I certainly don't have the coding skills to write a unix
file system, or provide a facility that may stray from the standards.

Maybe I'm on crack; it's been a long day after all.  Anybody know of a
way to stat a file's original creation time on Unix or a standard
external system that can be used to track such information?  Or is
this from the "It's not important, so we don't care," department?  I
have no need of the information currently, but this has dug into the
better side of my curiosity.

| sam -- Programmer I                                                |
| University of California, Davis : Hart Interdisciplinary Programs  |
| GPG Fingerprint: 4F08 E33E 92A2 EA88 CE75  75DC D84C 6046 0240 515F|

Attachment: pgp00000.pgp
Description: PGP signature

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.