आपकी फ़ाइलों में से प्रत्येक के लिए केवल तीन अलग-अलग मान संग्रहीत हैं, जैसे कि POSIX मानक द्वारा परिभाषित : http://pubs.opengroup.org/onlinepubs/9699919799/ ( आधार परिभाषा अनुभाग देखें -> 4. सामान्य अवधारणाएँ -> 4.8 फ़ाइल टाइम्स अपडेट)
प्रत्येक फ़ाइल में तीन अलग-अलग संबद्ध टाइमस्टैम्प्स होते हैं: अंतिम डेटा एक्सेस का समय, अंतिम डेटा संशोधन का समय और फ़ाइल का समय बदल जाता है । फ़ाइल मान संरचना संरचना स्टेट में ये मान लौटाए गए हैं, जैसा कि <sys / stat.h> में वर्णित है ।
और <sys / stat.h> से :
atime is for Last data access timestamp.
mtime is for Last data modification timestamp.
ctime is for Last file status change timestamp.
उदाहरण शो के बाद के बीच अंतर atime , mtime और ctime , इन उदाहरणों जीएनयू / लिनक्स मार रहे हैं। आप stat -xमैक ओएस एक्स या अन्य बीएसडी डिस्ट में उपयोग कर सकते हैं । समान आउटपुट स्वरूप देखने के लिए।
$ stat --version
stat (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Michael Meskes.
$
$ touch test
$ stat test
File: `test'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 811h/2065d Inode: 98828525 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 514/ rank) Gid: ( 514/ rank)
Access: 2014-03-16 10:58:28.609223953 +0800
Modify: 2014-03-16 10:58:28.609223953 +0800
Change: 2014-03-16 10:58:28.609223953 +0800
जब फ़ाइल बनाई जाती है, तो तीन टाइमस्टैम्प समान होते हैं।
1. अतीम
सबसे पहले, चलो का उपयोग फ़ाइल के डेटा इसे पढ़ने (द्वारा lessया vim), यह पता मुद्रण ( cat) एक और फाइल करने के लिए या इसे कॉपी ( cp)।
$ cat test #Nothing will be printed out, since the file is empty
$ stat test
File: `test'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 811h/2065d Inode: 98828525 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 514/ rank) Gid: ( 514/ rank)
Access: 2014-03-16 10:59:13.182301069 +0800 <-- atime Changed!
Modify: 2014-03-16 10:58:28.609223953 +0800
Change: 2014-03-16 10:58:28.609223953 +0800
2. समय
अब चलो चलो बदलने , फ़ाइल स्थिति अनुमति (बदलकर chmod) या इसका नाम ( mv)
$ chmod u+x test
$ stat stet
File: `test'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 811h/2065d Inode: 98828525 Links: 1
Access: (0764/-rwxrw-r--) Uid: ( 514/ rank) Gid: ( 514/ rank)
Access: 2014-03-16 10:59:13.182301069 +0800
Modify: 2014-03-16 10:58:28.609223953 +0800
Change: 2014-03-16 11:04:10.178285430 +0800 <-- ctime Changed!
$
$ mv test testing
$ stat testing
File: `testing'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 811h/2065d Inode: 98828525 Links: 1
Access: (0764/-rwxrw-r--) Uid: ( 514/ rank) Gid: ( 514/ rank)
Access: 2014-03-16 10:59:13.182301069 +0800
Modify: 2014-03-16 10:58:28.609223953 +0800
Change: 2014-03-16 11:06:33.342207679 +0800 <-- ctime Changed again!
ध्यान दें कि अब तक, फ़ाइल की सामग्री ( डेटा ) अभी भी वैसी ही है, जब यह बनाई गई थी।
3. माइम
अंत में, फ़ाइल को संपादित करके फ़ाइल की सामग्री को संशोधित करें।
$ echo 'Modify the DATA of the file' > testing
$ echo 'Modify the DATA of the file also change the file status' > testing
$ stat testing
File: `testing'
Size: 56 Blocks: 8 IO Block: 4096 regular file
Device: 811h/2065d Inode: 98828525 Links: 1
Access: (0764/-rwxrw-r--) Uid: ( 514/ rank) Gid: ( 514/ rank)
Access: 2014-03-16 10:59:13.182301069 +0800
Modify: 2014-03-16 11:09:48.247345148 +0800 <-- mtime Changed!
Change: 2014-03-16 11:09:48.247345148 +0800 <-- ctime also Changed!
4. जन्म समय
यह भी ध्यान दें कि stat(जैसे stat --version 8.13कि Ubuntu 12.04 में) के नए संस्करण में 4 टाइमस्टैम्प की जानकारी है - जन्म समय (फ़ाइल निर्माण समय)। हालाँकि यह अभी के लिए सही समय नहीं दिखा सकता है:
$ stat --version
stat (GNU coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Michael Meskes.
$
$ stat birth_time
File: `birth_time'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 805h/2053d Inode: 4073946 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ bingyao) Gid: ( 1000/ bingyao)
Access: 2014-03-16 10:46:48.838718970 +0800
Modify: 2014-03-16 10:46:48.838718970 +0800
Change: 2014-03-16 10:46:48.838718970 +0800
Birth: -