Is there some special reason that Windows can tell you a file's creation time, but Linux generally does not?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Historically UNIX hasn't stored the birth information.
I guess the guys who designed the UNIX filesystem were happy enough with just having Modification time and saw no use for birth time. Keep in mind that back then disks weren't very big and an extra (arguably useless) timestamp field for every file would be considered wasteful.
BTW, birthtime isn't always empty on linux. Depends on the filesystem type.
BTW, birth time isn't always empty on linux. Depends on the filesystem type.
And kernel version. As of version 4.11 or so system calls to retrieve birth time have been available but yes it also depends on filesystem type. The birth time is "stored" in the file's inode but has not been readily available to the user.
And, just so you are aware, while Linux does not report that time Windows will. But it often lies!
Unix style file systems have interesting time stamps, that reflect the philosophy and expected use of the file system. The time it was created is not interesting to Unix/Linux systems, but the last time it was MODIFIED matters! For some things, the last time it was ACCESSED used to matter, but very little uses that these days.
At core: Windows is not Linux, and Linux is not Windows, and no one should expect them to act the same way. EVER!
not to speak about a lot of "questions", like what would be the creation time when you move/copy a file to another location? Should it keep the old value, or should it be the current time (since a new file was created). When you edit a file usually the old version is removed and a new file is created. Should it keep that creation time (time of birth)? What would be the creation time when you restore something from backup (on a different host/disk)? Or what should be used when you install (download) a package? Keep the time when the package was created?
You can use 'stat' to get a files inode number and then 'debugfs' to get atime, ctime, mtime and crtime (creation time.) A search for stat and debugfs should turn up some methods for you. There will be cautions against 'borking' your system.
Last edited by mjolnir; 03-27-2024 at 11:15 AM.
Reason: Spelling
When you edit a file usually the old version is removed and a new file is created. Should it keep that creation time (time of birth)? What would be the creation time when you restore something from backup (on a different host/disk)? Or what should be used when you install (download) a package? Keep the time when the package was created?
We had Vax minicomputers at work and they ran VMS. VMS filenames had a generation number as well as a name. istr it was appended to the name (where required) with a semicolon. If you edited a file and wrote it back, it was given a different number but the old version was not deleted unless you specified that it should be. The default version was always the latest one, so most people didn't bother with these numbers, but they must have been very useful for developers.
We had Vax minicomputers at work and they ran VMS. VMS filenames had a generation number as well as a name. istr it was appended to the name (where required) with a semicolon. If you edited a file and wrote it back, it was given a different number but the old version was not deleted unless you specified that it should be. The default version was always the latest one, so most people didn't bother with these numbers, but they must have been very useful for developers.
At core: Windows is not Linux, and Linux is not Windows, and no one should expect them to act the same way. EVER!
People on LQ trotting out this crap every time someone contrasts to Windows is tiring, and that ridiculous "EVER!" is simple nonsense.
Yes, there are plenty of underlying differences - and historic rationales for those differences - but there are also numerous examples where one has copied a feature from the other (and vice versa), or both have copied from somewhere else, because that particular feature is useful for users. The usefulness of features can sometimes only takes a short while to realise, whilst other times it can takes decades.
There will also probably always be some underlying differences, because people have different needs. Understanding why there are differences can be useful and interesting. Telling people to "just accept it" is not.
Quote:
Originally Posted by wh33t
I just learned about the [stat] command and am sad to see that the Birth time is always empty
People on LQ trotting out this crap every time someone contrasts to Windows is tiring, and that ridiculous "EVER!" is simple nonsense.
Yes, there are plenty of underlying differences - and historic rationales for those differences - but there are also numerous examples where one has copied a feature from the other (and vice versa), or both have copied from somewhere else, because that particular feature is useful for users. The usefulness of features can sometimes only takes a short while to realise, whilst other times it can takes decades.
There will also probably always be some underlying differences, because people have different needs. Understanding why there are differences can be useful and interesting. Telling people to "just accept it" is not.
Which is why I FIRST explained the file system issues involved, and never told anyone to "just accept it"!
I recommend they EXPECT it, which is a different thing. I also encourage people to ADD capabilities or features to Linux if they have the ability and really want that. We cannot do that to Windows (or other closed-source software) but we absolutely CAN do that with Linux!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.