How to get file creation date/time in Bash/Debian? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Checking when a folder was created in Bash?How to get proper file creation date of file?find oldest file from listCheck if file was created more than 10 minutes from nowbash to select oldest folder in directory and write to logHow to extract “Create Date” in a faster way than with “identify”How to sort/group files by time created, in chunks of related filesGet the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashHow to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?How can I redirect and append both stdout and stderr to a file with Bash?How do I split a string on a delimiter in Bash?How to check if a variable is set in Bash?How to concatenate string variables in BashHow do I set a variable to the output of a command in Bash?How do I find all files containing specific text on Linux?
How much damage would a cupful of neutron star matter do to the Earth?
Most bit efficient text communication method?
Effects on objects due to a brief relocation of massive amounts of mass
Performance gap between vector<bool> and array
Is CEO the "profession" with the most psychopaths?
If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?
Why do we need to use the builder design pattern when we can do the same thing with setters?
What's the meaning of "fortified infraction restraint"?
How to compare two different files line by line in unix?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode
What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?
Why is Nikon 1.4g better when Nikon 1.8g is sharper?
Did Deadpool rescue all of the X-Force?
How to write this math term? with cases it isn't working
Should I use a zero-interest credit card for a large one-time purchase?
Dating a Former Employee
Is it a good idea to use CNN to classify 1D signal?
Why is it faster to reheat something than it is to cook it?
Illegal assignment from sObject to Id
Take 2! Is this homebrew Lady of Pain warlock patron balanced?
AppleTVs create a chatty alternate WiFi network
How to play a character with a disability or mental disorder without being offensive?
How come Sam didn't become Lord of Horn Hill?
How to get file creation date/time in Bash/Debian?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Checking when a folder was created in Bash?How to get proper file creation date of file?find oldest file from listCheck if file was created more than 10 minutes from nowbash to select oldest folder in directory and write to logHow to extract “Create Date” in a faster way than with “identify”How to sort/group files by time created, in chunks of related filesGet the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashHow to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?How can I redirect and append both stdout and stderr to a file with Bash?How do I split a string on a delimiter in Bash?How to check if a variable is set in Bash?How to concatenate string variables in BashHow do I set a variable to the output of a command in Bash?How do I find all files containing specific text on Linux?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time.ls -lh a.txt
and stat -c %y a.txt
both only give the modification time.
linux bash shell debian ls
add a comment |
I'm using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time.ls -lh a.txt
and stat -c %y a.txt
both only give the modification time.
linux bash shell debian ls
4
Are you using a filesystem that records creation time? Most don't.
– William Pursell
Feb 12 '13 at 21:34
See askubuntu.com/questions/470134/…
– John Red
May 18 '16 at 19:49
add a comment |
I'm using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time.ls -lh a.txt
and stat -c %y a.txt
both only give the modification time.
linux bash shell debian ls
I'm using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time.ls -lh a.txt
and stat -c %y a.txt
both only give the modification time.
linux bash shell debian ls
linux bash shell debian ls
asked Feb 12 '13 at 21:30
NoodleFolkNoodleFolk
9961823
9961823
4
Are you using a filesystem that records creation time? Most don't.
– William Pursell
Feb 12 '13 at 21:34
See askubuntu.com/questions/470134/…
– John Red
May 18 '16 at 19:49
add a comment |
4
Are you using a filesystem that records creation time? Most don't.
– William Pursell
Feb 12 '13 at 21:34
See askubuntu.com/questions/470134/…
– John Red
May 18 '16 at 19:49
4
4
Are you using a filesystem that records creation time? Most don't.
– William Pursell
Feb 12 '13 at 21:34
Are you using a filesystem that records creation time? Most don't.
– William Pursell
Feb 12 '13 at 21:34
See askubuntu.com/questions/470134/…
– John Red
May 18 '16 at 19:49
See askubuntu.com/questions/470134/…
– John Red
May 18 '16 at 19:49
add a comment |
12 Answers
12
active
oldest
votes
Unfortunately your quest won't be possible in general, as there are only 3 distinct time values stored for each of your files as defined by the POSIX standard (see Base Definitions section 4.8 File Times Update)
Each file has three distinct associated timestamps: the time of last
data access, the time of last data modification, and the time the file
status last changed. These values are returned in the file
characteristics structure struct stat, as described in <sys/stat.h>.
EDIT: As mentioned in the comments below, depending on the filesystem used metadata may contain file creation date. Note however storage of information like that is non standard. Depending on it may lead to portability problems moving to another filesystem, in case the one actually used somehow stores it anyways.
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
5
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
add a comment |
ls -i file #output is for me 68551981
debugfs -R 'stat <68551981>' /dev/sda3 # /dev/sda3 is the disk on which the file exists
#results - crtime value
[root@loft9156 ~]# debugfs -R 'stat <68551981>' /dev/sda3
debugfs 1.41.12 (17-May-2010)
Inode: 68551981 Type: regular Mode: 0644 Flags: 0x80000
Generation: 769802755 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 38973440
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 76128
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
atime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013
mtime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
**crtime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013**
Size of extra inode fields: 28
EXTENTS:
(0-511): 352633728-352634239, (512-1023): 352634368-352634879, (1024-2047): 288392192-288393215, (2048-4095): 355803136-355805183, (4096-6143): 357941248-357943295, (6144
-9514): 357961728-357965098
1
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
1
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
11
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
|
show 1 more comment
mikyra's answer is good.The fact just like what he said.
[jason@rh5 test]$ stat test.txt
File: `test.txt'
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 588720 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ jason) Gid: ( 500/ jason)
Access: 2013-03-14 01:58:12.000000000 -0700
Modify: 2013-03-14 01:58:12.000000000 -0700
Change: 2013-03-14 01:58:12.000000000 -0700
if you want to verify wich file was created first,you can structure your file name by appending system date when you create a series of files.
6
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
add a comment |
Note that if you've got your filesystem mounted with noatime for performance reasons, then the atime will likely show the creation time. Given that noatime results in a massive performance boost (by removing a disk write for every time a file is read), it may be a sensible configuration option that also gives you the results you want.
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
add a comment |
Creation date/time is normally not stored. So no, you can't.
add a comment |
ls -i menus.xml
94490 menus.xml
Here the number 94490 represents inode
Then do a:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 4.0G 3.4G 408M 90% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 124M 27M 92M 23% /boot
/dev/mapper/vg-var 7.9G 1.1G 6.5G 15% /var
To find the mounting point of the root "/" filesystem, because the file menus.xml is on '/' that is '/dev/mapper/vg-root'
debugfs -R 'stat <94490>' /dev/mapper/vg-root
The output may be like the one below:
debugfs -R 'stat <94490>' /dev/mapper/vg-root
debugfs 1.41.12 (17-May-2010)
Inode: 94490 Type: regular Mode: 0644 Flags: 0x0
Generation: 2826123170 Version: 0x00000000
User: 0 Group: 0 Size: 4441
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
atime: 0x5266e47b -- Wed Oct 23 09:47:55 2013
mtime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
Size of extra inode fields: 4
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:usr_t:s000" (31)
BLOCKS:
(0-1):375818-375819
TOTAL: 2
Where you can see the creation time:
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
15
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
2
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
add a comment |
You can find creation time - aka birth time - using stat and also match using find.
We have these files showing last modified time:
$ ls -l --time-style=long-iso | sort -k6
total 692
-rwxrwx---+ 1 XXXX XXXX 249159 2013-05-31 14:47 Getting Started.pdf
-rwxrwx---+ 1 XXXX XXXX 275799 2013-12-30 21:12 TheScienceofGettingRich.pdf
-rwxrwx---+ 1 XXXX XXXX 25600 2015-05-07 18:52 Thumbs.db
-rwxrwx---+ 1 XXXX XXXX 148051 2015-05-07 18:55 AsAManThinketh.pdf
To find files created within a certain time frame using find as below.
Clearly, the filesystem knows about the birth time of a file:
$ find -newerBt '2014-06-13' ! -newerBt '2014-06-13 12:16:10' -ls
20547673299906851 148 -rwxrwx--- 1 XXXX XXXX 148051 May 7 18:55 ./AsAManThinketh.pdf
1407374883582246 244 -rwxrwx--- 1 XXXX XXXX 249159 May 31 2013 ./Getting Started.pdf
We can confirm this using stat:
$ stat -c "%w %n" * | sort
2014-06-13 12:16:03.873778400 +0100 AsAManThinketh.pdf
2014-06-13 12:16:04.006872500 +0100 Getting Started.pdf
2014-06-13 12:16:29.607075500 +0100 TheScienceofGettingRich.pdf
2015-05-07 18:32:26.938446200 +0100 Thumbs.db
stat man pages explains %w:
%w time of file birth, human-readable; - if unknown
It seemsls -l
displays Modify time, not Creation or Birth time
– truf
Mar 6 at 20:21
add a comment |
As @mikyra explained, creation date time is not stored anywhere.
All the methods above are nice, but if you want to quickly get only last modify date, you can type:
ls -lit /path
with -t option you list all file in /path odered by last modify date.
add a comment |
If you really want to achieve that you can use a file watcher like inotifywait.
You watch a directory and you save information about file creations in separate file outside that directory.
while true; do
change=$(inotifywait -e close_write,moved_to,create .)
change=$change#./ *
if [ "$change" = ".*" ]; then ./scriptToStoreInfoAboutFile; fi
done
As no creation time is stored, you can build your own system based on inotify.
add a comment |
Cited from https://unix.stackexchange.com/questions/50177/birth-is-empty-on-ext4/131347#131347 , the following shellscript would work to get creation time:
get_crtime() tail -1
add a comment |
even better:
lsct ()
(read a b;echo -n $a)`'>' `df "$1"
lsct /etc
Wed Jul 20 19:25:48 2016
add a comment |
Another trick to add to your arsenal is the following:
$ grep -r "Copyright" /<path-to-source-files>/src
Generally speaking, if one changes a file they should claim credit in the “Copyright”. Examine the results for dates, file names, contributors and contact email.
example grep result:
/<path>/src/someobject.h: * Copyright 2007-2012 <creator's name> <creator's email>(at)<some URL>>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14842195%2fhow-to-get-file-creation-date-time-in-bash-debian%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
Unfortunately your quest won't be possible in general, as there are only 3 distinct time values stored for each of your files as defined by the POSIX standard (see Base Definitions section 4.8 File Times Update)
Each file has three distinct associated timestamps: the time of last
data access, the time of last data modification, and the time the file
status last changed. These values are returned in the file
characteristics structure struct stat, as described in <sys/stat.h>.
EDIT: As mentioned in the comments below, depending on the filesystem used metadata may contain file creation date. Note however storage of information like that is non standard. Depending on it may lead to portability problems moving to another filesystem, in case the one actually used somehow stores it anyways.
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
5
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
add a comment |
Unfortunately your quest won't be possible in general, as there are only 3 distinct time values stored for each of your files as defined by the POSIX standard (see Base Definitions section 4.8 File Times Update)
Each file has three distinct associated timestamps: the time of last
data access, the time of last data modification, and the time the file
status last changed. These values are returned in the file
characteristics structure struct stat, as described in <sys/stat.h>.
EDIT: As mentioned in the comments below, depending on the filesystem used metadata may contain file creation date. Note however storage of information like that is non standard. Depending on it may lead to portability problems moving to another filesystem, in case the one actually used somehow stores it anyways.
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
5
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
add a comment |
Unfortunately your quest won't be possible in general, as there are only 3 distinct time values stored for each of your files as defined by the POSIX standard (see Base Definitions section 4.8 File Times Update)
Each file has three distinct associated timestamps: the time of last
data access, the time of last data modification, and the time the file
status last changed. These values are returned in the file
characteristics structure struct stat, as described in <sys/stat.h>.
EDIT: As mentioned in the comments below, depending on the filesystem used metadata may contain file creation date. Note however storage of information like that is non standard. Depending on it may lead to portability problems moving to another filesystem, in case the one actually used somehow stores it anyways.
Unfortunately your quest won't be possible in general, as there are only 3 distinct time values stored for each of your files as defined by the POSIX standard (see Base Definitions section 4.8 File Times Update)
Each file has three distinct associated timestamps: the time of last
data access, the time of last data modification, and the time the file
status last changed. These values are returned in the file
characteristics structure struct stat, as described in <sys/stat.h>.
EDIT: As mentioned in the comments below, depending on the filesystem used metadata may contain file creation date. Note however storage of information like that is non standard. Depending on it may lead to portability problems moving to another filesystem, in case the one actually used somehow stores it anyways.
edited Sep 13 '15 at 21:43
answered Feb 12 '13 at 21:41
mikyramikyra
7,4282838
7,4282838
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
5
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
add a comment |
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
5
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
pubs.opengroup.org/onlinepubs/9699919799/basedefs/…
– Gilles Quenot
Feb 13 '13 at 0:39
5
5
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Such sad news. It'd be so useful right now to determine easily whether a file has been deleted and recreated or has been there all along.
– froggythefrog
Dec 17 '14 at 19:17
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
Do you know how that works on a Mac? The Finder shows three timestamps as 'Created', 'Modified', 'Last openend'...
– johk95
Mar 5 '15 at 21:39
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
yes it is possible: unix.stackexchange.com/a/131347/52733
– Edward Torvalds
Aug 21 '15 at 16:42
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
Strongly dependant on the filesystem used. But good point anyways. :)Tried to add the missing information to the post.
– mikyra
Sep 13 '15 at 21:47
add a comment |
ls -i file #output is for me 68551981
debugfs -R 'stat <68551981>' /dev/sda3 # /dev/sda3 is the disk on which the file exists
#results - crtime value
[root@loft9156 ~]# debugfs -R 'stat <68551981>' /dev/sda3
debugfs 1.41.12 (17-May-2010)
Inode: 68551981 Type: regular Mode: 0644 Flags: 0x80000
Generation: 769802755 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 38973440
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 76128
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
atime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013
mtime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
**crtime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013**
Size of extra inode fields: 28
EXTENTS:
(0-511): 352633728-352634239, (512-1023): 352634368-352634879, (1024-2047): 288392192-288393215, (2048-4095): 355803136-355805183, (4096-6143): 357941248-357943295, (6144
-9514): 357961728-357965098
1
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
1
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
11
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
|
show 1 more comment
ls -i file #output is for me 68551981
debugfs -R 'stat <68551981>' /dev/sda3 # /dev/sda3 is the disk on which the file exists
#results - crtime value
[root@loft9156 ~]# debugfs -R 'stat <68551981>' /dev/sda3
debugfs 1.41.12 (17-May-2010)
Inode: 68551981 Type: regular Mode: 0644 Flags: 0x80000
Generation: 769802755 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 38973440
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 76128
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
atime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013
mtime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
**crtime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013**
Size of extra inode fields: 28
EXTENTS:
(0-511): 352633728-352634239, (512-1023): 352634368-352634879, (1024-2047): 288392192-288393215, (2048-4095): 355803136-355805183, (4096-6143): 357941248-357943295, (6144
-9514): 357961728-357965098
1
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
1
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
11
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
|
show 1 more comment
ls -i file #output is for me 68551981
debugfs -R 'stat <68551981>' /dev/sda3 # /dev/sda3 is the disk on which the file exists
#results - crtime value
[root@loft9156 ~]# debugfs -R 'stat <68551981>' /dev/sda3
debugfs 1.41.12 (17-May-2010)
Inode: 68551981 Type: regular Mode: 0644 Flags: 0x80000
Generation: 769802755 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 38973440
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 76128
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
atime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013
mtime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
**crtime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013**
Size of extra inode fields: 28
EXTENTS:
(0-511): 352633728-352634239, (512-1023): 352634368-352634879, (1024-2047): 288392192-288393215, (2048-4095): 355803136-355805183, (4096-6143): 357941248-357943295, (6144
-9514): 357961728-357965098
ls -i file #output is for me 68551981
debugfs -R 'stat <68551981>' /dev/sda3 # /dev/sda3 is the disk on which the file exists
#results - crtime value
[root@loft9156 ~]# debugfs -R 'stat <68551981>' /dev/sda3
debugfs 1.41.12 (17-May-2010)
Inode: 68551981 Type: regular Mode: 0644 Flags: 0x80000
Generation: 769802755 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 38973440
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 76128
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
atime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013
mtime: 0x526931d7:1697cce0 -- Thu Oct 24 16:42:31 2013
**crtime: 0x52691f4d:7694eda4 -- Thu Oct 24 15:23:25 2013**
Size of extra inode fields: 28
EXTENTS:
(0-511): 352633728-352634239, (512-1023): 352634368-352634879, (1024-2047): 288392192-288393215, (2048-4095): 355803136-355805183, (4096-6143): 357941248-357943295, (6144
-9514): 357961728-357965098
edited Nov 17 '13 at 10:35
Dmitry Pashkevich
9,26584265
9,26584265
answered Oct 24 '13 at 14:42
user2725883user2725883
36433
36433
1
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
1
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
11
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
|
show 1 more comment
1
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
1
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
11
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
1
1
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
what's the meaning for ctime, atime and mtime?
– Luca Davanzo
Feb 21 '14 at 15:30
1
1
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
@Velthune Creation time, Access time, Modification time. However depending on the way the filesystem is configured these values may or may not be accurate. For instance, many people disable writing last access time to files to save on the extra disk writes.
– indivisible
May 9 '14 at 6:37
11
11
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
@indivisible: FALSE! POSIX standards define ctime as change time. This is when some file attribute changes, generally.
– ingyhere
Oct 1 '14 at 1:38
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
I don't know the standards, but the ctime here is after the atime. I would assume creation time should be the oldest...
– bartgol
Mar 2 '15 at 14:57
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
What's the difference between change time and modification time?
– RonJohn
Dec 3 '17 at 23:11
|
show 1 more comment
mikyra's answer is good.The fact just like what he said.
[jason@rh5 test]$ stat test.txt
File: `test.txt'
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 588720 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ jason) Gid: ( 500/ jason)
Access: 2013-03-14 01:58:12.000000000 -0700
Modify: 2013-03-14 01:58:12.000000000 -0700
Change: 2013-03-14 01:58:12.000000000 -0700
if you want to verify wich file was created first,you can structure your file name by appending system date when you create a series of files.
6
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
add a comment |
mikyra's answer is good.The fact just like what he said.
[jason@rh5 test]$ stat test.txt
File: `test.txt'
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 588720 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ jason) Gid: ( 500/ jason)
Access: 2013-03-14 01:58:12.000000000 -0700
Modify: 2013-03-14 01:58:12.000000000 -0700
Change: 2013-03-14 01:58:12.000000000 -0700
if you want to verify wich file was created first,you can structure your file name by appending system date when you create a series of files.
6
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
add a comment |
mikyra's answer is good.The fact just like what he said.
[jason@rh5 test]$ stat test.txt
File: `test.txt'
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 588720 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ jason) Gid: ( 500/ jason)
Access: 2013-03-14 01:58:12.000000000 -0700
Modify: 2013-03-14 01:58:12.000000000 -0700
Change: 2013-03-14 01:58:12.000000000 -0700
if you want to verify wich file was created first,you can structure your file name by appending system date when you create a series of files.
mikyra's answer is good.The fact just like what he said.
[jason@rh5 test]$ stat test.txt
File: `test.txt'
Size: 0 Blocks: 8 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 588720 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ jason) Gid: ( 500/ jason)
Access: 2013-03-14 01:58:12.000000000 -0700
Modify: 2013-03-14 01:58:12.000000000 -0700
Change: 2013-03-14 01:58:12.000000000 -0700
if you want to verify wich file was created first,you can structure your file name by appending system date when you create a series of files.
answered Mar 14 '13 at 9:10
jasonjason
161115
161115
6
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
add a comment |
6
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
6
6
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
When I do stat myfile.txt, I get another row: Birth. Unfortunately, it has no value. Why is that row there?
– allyourcode
Oct 22 '13 at 19:19
add a comment |
Note that if you've got your filesystem mounted with noatime for performance reasons, then the atime will likely show the creation time. Given that noatime results in a massive performance boost (by removing a disk write for every time a file is read), it may be a sensible configuration option that also gives you the results you want.
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
add a comment |
Note that if you've got your filesystem mounted with noatime for performance reasons, then the atime will likely show the creation time. Given that noatime results in a massive performance boost (by removing a disk write for every time a file is read), it may be a sensible configuration option that also gives you the results you want.
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
add a comment |
Note that if you've got your filesystem mounted with noatime for performance reasons, then the atime will likely show the creation time. Given that noatime results in a massive performance boost (by removing a disk write for every time a file is read), it may be a sensible configuration option that also gives you the results you want.
Note that if you've got your filesystem mounted with noatime for performance reasons, then the atime will likely show the creation time. Given that noatime results in a massive performance boost (by removing a disk write for every time a file is read), it may be a sensible configuration option that also gives you the results you want.
answered Mar 14 '13 at 4:36
unit3unit3
23112
23112
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
add a comment |
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
I can't vouch for the performance boost, but I read a guide for SSD's that recommended noatime, so this worked for me.
– jake
Dec 13 '14 at 13:42
add a comment |
Creation date/time is normally not stored. So no, you can't.
add a comment |
Creation date/time is normally not stored. So no, you can't.
add a comment |
Creation date/time is normally not stored. So no, you can't.
Creation date/time is normally not stored. So no, you can't.
answered Feb 12 '13 at 21:34
user80168
add a comment |
add a comment |
ls -i menus.xml
94490 menus.xml
Here the number 94490 represents inode
Then do a:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 4.0G 3.4G 408M 90% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 124M 27M 92M 23% /boot
/dev/mapper/vg-var 7.9G 1.1G 6.5G 15% /var
To find the mounting point of the root "/" filesystem, because the file menus.xml is on '/' that is '/dev/mapper/vg-root'
debugfs -R 'stat <94490>' /dev/mapper/vg-root
The output may be like the one below:
debugfs -R 'stat <94490>' /dev/mapper/vg-root
debugfs 1.41.12 (17-May-2010)
Inode: 94490 Type: regular Mode: 0644 Flags: 0x0
Generation: 2826123170 Version: 0x00000000
User: 0 Group: 0 Size: 4441
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
atime: 0x5266e47b -- Wed Oct 23 09:47:55 2013
mtime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
Size of extra inode fields: 4
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:usr_t:s000" (31)
BLOCKS:
(0-1):375818-375819
TOTAL: 2
Where you can see the creation time:
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
15
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
2
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
add a comment |
ls -i menus.xml
94490 menus.xml
Here the number 94490 represents inode
Then do a:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 4.0G 3.4G 408M 90% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 124M 27M 92M 23% /boot
/dev/mapper/vg-var 7.9G 1.1G 6.5G 15% /var
To find the mounting point of the root "/" filesystem, because the file menus.xml is on '/' that is '/dev/mapper/vg-root'
debugfs -R 'stat <94490>' /dev/mapper/vg-root
The output may be like the one below:
debugfs -R 'stat <94490>' /dev/mapper/vg-root
debugfs 1.41.12 (17-May-2010)
Inode: 94490 Type: regular Mode: 0644 Flags: 0x0
Generation: 2826123170 Version: 0x00000000
User: 0 Group: 0 Size: 4441
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
atime: 0x5266e47b -- Wed Oct 23 09:47:55 2013
mtime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
Size of extra inode fields: 4
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:usr_t:s000" (31)
BLOCKS:
(0-1):375818-375819
TOTAL: 2
Where you can see the creation time:
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
15
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
2
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
add a comment |
ls -i menus.xml
94490 menus.xml
Here the number 94490 represents inode
Then do a:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 4.0G 3.4G 408M 90% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 124M 27M 92M 23% /boot
/dev/mapper/vg-var 7.9G 1.1G 6.5G 15% /var
To find the mounting point of the root "/" filesystem, because the file menus.xml is on '/' that is '/dev/mapper/vg-root'
debugfs -R 'stat <94490>' /dev/mapper/vg-root
The output may be like the one below:
debugfs -R 'stat <94490>' /dev/mapper/vg-root
debugfs 1.41.12 (17-May-2010)
Inode: 94490 Type: regular Mode: 0644 Flags: 0x0
Generation: 2826123170 Version: 0x00000000
User: 0 Group: 0 Size: 4441
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
atime: 0x5266e47b -- Wed Oct 23 09:47:55 2013
mtime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
Size of extra inode fields: 4
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:usr_t:s000" (31)
BLOCKS:
(0-1):375818-375819
TOTAL: 2
Where you can see the creation time:
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
ls -i menus.xml
94490 menus.xml
Here the number 94490 represents inode
Then do a:
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg-root 4.0G 3.4G 408M 90% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 124M 27M 92M 23% /boot
/dev/mapper/vg-var 7.9G 1.1G 6.5G 15% /var
To find the mounting point of the root "/" filesystem, because the file menus.xml is on '/' that is '/dev/mapper/vg-root'
debugfs -R 'stat <94490>' /dev/mapper/vg-root
The output may be like the one below:
debugfs -R 'stat <94490>' /dev/mapper/vg-root
debugfs 1.41.12 (17-May-2010)
Inode: 94490 Type: regular Mode: 0644 Flags: 0x0
Generation: 2826123170 Version: 0x00000000
User: 0 Group: 0 Size: 4441
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 16
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
atime: 0x5266e47b -- Wed Oct 23 09:47:55 2013
mtime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
Size of extra inode fields: 4
Extended attributes stored in inode body:
selinux = "unconfined_u:object_r:usr_t:s000" (31)
BLOCKS:
(0-1):375818-375819
TOTAL: 2
Where you can see the creation time:
ctime: 0x5266e438 -- Wed Oct 23 09:46:48 2013
answered Oct 22 '13 at 22:30
GustavoHGustavoH
19719
19719
15
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
2
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
add a comment |
15
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
2
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
15
15
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
ctime is not the creation time, it's the "time of last modification of the file status information"
– mokalan
Oct 27 '13 at 10:14
2
2
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
ctime = "change time" where change means modification of owner, group, privileges or some other attribute. It's not necessarily the creation time.
– ingyhere
Oct 1 '14 at 1:33
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
it's crtime and not ctime.. but thanks!
– Zibri
Dec 23 '16 at 10:37
add a comment |
You can find creation time - aka birth time - using stat and also match using find.
We have these files showing last modified time:
$ ls -l --time-style=long-iso | sort -k6
total 692
-rwxrwx---+ 1 XXXX XXXX 249159 2013-05-31 14:47 Getting Started.pdf
-rwxrwx---+ 1 XXXX XXXX 275799 2013-12-30 21:12 TheScienceofGettingRich.pdf
-rwxrwx---+ 1 XXXX XXXX 25600 2015-05-07 18:52 Thumbs.db
-rwxrwx---+ 1 XXXX XXXX 148051 2015-05-07 18:55 AsAManThinketh.pdf
To find files created within a certain time frame using find as below.
Clearly, the filesystem knows about the birth time of a file:
$ find -newerBt '2014-06-13' ! -newerBt '2014-06-13 12:16:10' -ls
20547673299906851 148 -rwxrwx--- 1 XXXX XXXX 148051 May 7 18:55 ./AsAManThinketh.pdf
1407374883582246 244 -rwxrwx--- 1 XXXX XXXX 249159 May 31 2013 ./Getting Started.pdf
We can confirm this using stat:
$ stat -c "%w %n" * | sort
2014-06-13 12:16:03.873778400 +0100 AsAManThinketh.pdf
2014-06-13 12:16:04.006872500 +0100 Getting Started.pdf
2014-06-13 12:16:29.607075500 +0100 TheScienceofGettingRich.pdf
2015-05-07 18:32:26.938446200 +0100 Thumbs.db
stat man pages explains %w:
%w time of file birth, human-readable; - if unknown
It seemsls -l
displays Modify time, not Creation or Birth time
– truf
Mar 6 at 20:21
add a comment |
You can find creation time - aka birth time - using stat and also match using find.
We have these files showing last modified time:
$ ls -l --time-style=long-iso | sort -k6
total 692
-rwxrwx---+ 1 XXXX XXXX 249159 2013-05-31 14:47 Getting Started.pdf
-rwxrwx---+ 1 XXXX XXXX 275799 2013-12-30 21:12 TheScienceofGettingRich.pdf
-rwxrwx---+ 1 XXXX XXXX 25600 2015-05-07 18:52 Thumbs.db
-rwxrwx---+ 1 XXXX XXXX 148051 2015-05-07 18:55 AsAManThinketh.pdf
To find files created within a certain time frame using find as below.
Clearly, the filesystem knows about the birth time of a file:
$ find -newerBt '2014-06-13' ! -newerBt '2014-06-13 12:16:10' -ls
20547673299906851 148 -rwxrwx--- 1 XXXX XXXX 148051 May 7 18:55 ./AsAManThinketh.pdf
1407374883582246 244 -rwxrwx--- 1 XXXX XXXX 249159 May 31 2013 ./Getting Started.pdf
We can confirm this using stat:
$ stat -c "%w %n" * | sort
2014-06-13 12:16:03.873778400 +0100 AsAManThinketh.pdf
2014-06-13 12:16:04.006872500 +0100 Getting Started.pdf
2014-06-13 12:16:29.607075500 +0100 TheScienceofGettingRich.pdf
2015-05-07 18:32:26.938446200 +0100 Thumbs.db
stat man pages explains %w:
%w time of file birth, human-readable; - if unknown
It seemsls -l
displays Modify time, not Creation or Birth time
– truf
Mar 6 at 20:21
add a comment |
You can find creation time - aka birth time - using stat and also match using find.
We have these files showing last modified time:
$ ls -l --time-style=long-iso | sort -k6
total 692
-rwxrwx---+ 1 XXXX XXXX 249159 2013-05-31 14:47 Getting Started.pdf
-rwxrwx---+ 1 XXXX XXXX 275799 2013-12-30 21:12 TheScienceofGettingRich.pdf
-rwxrwx---+ 1 XXXX XXXX 25600 2015-05-07 18:52 Thumbs.db
-rwxrwx---+ 1 XXXX XXXX 148051 2015-05-07 18:55 AsAManThinketh.pdf
To find files created within a certain time frame using find as below.
Clearly, the filesystem knows about the birth time of a file:
$ find -newerBt '2014-06-13' ! -newerBt '2014-06-13 12:16:10' -ls
20547673299906851 148 -rwxrwx--- 1 XXXX XXXX 148051 May 7 18:55 ./AsAManThinketh.pdf
1407374883582246 244 -rwxrwx--- 1 XXXX XXXX 249159 May 31 2013 ./Getting Started.pdf
We can confirm this using stat:
$ stat -c "%w %n" * | sort
2014-06-13 12:16:03.873778400 +0100 AsAManThinketh.pdf
2014-06-13 12:16:04.006872500 +0100 Getting Started.pdf
2014-06-13 12:16:29.607075500 +0100 TheScienceofGettingRich.pdf
2015-05-07 18:32:26.938446200 +0100 Thumbs.db
stat man pages explains %w:
%w time of file birth, human-readable; - if unknown
You can find creation time - aka birth time - using stat and also match using find.
We have these files showing last modified time:
$ ls -l --time-style=long-iso | sort -k6
total 692
-rwxrwx---+ 1 XXXX XXXX 249159 2013-05-31 14:47 Getting Started.pdf
-rwxrwx---+ 1 XXXX XXXX 275799 2013-12-30 21:12 TheScienceofGettingRich.pdf
-rwxrwx---+ 1 XXXX XXXX 25600 2015-05-07 18:52 Thumbs.db
-rwxrwx---+ 1 XXXX XXXX 148051 2015-05-07 18:55 AsAManThinketh.pdf
To find files created within a certain time frame using find as below.
Clearly, the filesystem knows about the birth time of a file:
$ find -newerBt '2014-06-13' ! -newerBt '2014-06-13 12:16:10' -ls
20547673299906851 148 -rwxrwx--- 1 XXXX XXXX 148051 May 7 18:55 ./AsAManThinketh.pdf
1407374883582246 244 -rwxrwx--- 1 XXXX XXXX 249159 May 31 2013 ./Getting Started.pdf
We can confirm this using stat:
$ stat -c "%w %n" * | sort
2014-06-13 12:16:03.873778400 +0100 AsAManThinketh.pdf
2014-06-13 12:16:04.006872500 +0100 Getting Started.pdf
2014-06-13 12:16:29.607075500 +0100 TheScienceofGettingRich.pdf
2015-05-07 18:32:26.938446200 +0100 Thumbs.db
stat man pages explains %w:
%w time of file birth, human-readable; - if unknown
answered May 7 '15 at 18:31
zanfilipzanfilip
491
491
It seemsls -l
displays Modify time, not Creation or Birth time
– truf
Mar 6 at 20:21
add a comment |
It seemsls -l
displays Modify time, not Creation or Birth time
– truf
Mar 6 at 20:21
It seems
ls -l
displays Modify time, not Creation or Birth time– truf
Mar 6 at 20:21
It seems
ls -l
displays Modify time, not Creation or Birth time– truf
Mar 6 at 20:21
add a comment |
As @mikyra explained, creation date time is not stored anywhere.
All the methods above are nice, but if you want to quickly get only last modify date, you can type:
ls -lit /path
with -t option you list all file in /path odered by last modify date.
add a comment |
As @mikyra explained, creation date time is not stored anywhere.
All the methods above are nice, but if you want to quickly get only last modify date, you can type:
ls -lit /path
with -t option you list all file in /path odered by last modify date.
add a comment |
As @mikyra explained, creation date time is not stored anywhere.
All the methods above are nice, but if you want to quickly get only last modify date, you can type:
ls -lit /path
with -t option you list all file in /path odered by last modify date.
As @mikyra explained, creation date time is not stored anywhere.
All the methods above are nice, but if you want to quickly get only last modify date, you can type:
ls -lit /path
with -t option you list all file in /path odered by last modify date.
answered Feb 21 '14 at 15:41
Luca DavanzoLuca Davanzo
13.4k1079109
13.4k1079109
add a comment |
add a comment |
If you really want to achieve that you can use a file watcher like inotifywait.
You watch a directory and you save information about file creations in separate file outside that directory.
while true; do
change=$(inotifywait -e close_write,moved_to,create .)
change=$change#./ *
if [ "$change" = ".*" ]; then ./scriptToStoreInfoAboutFile; fi
done
As no creation time is stored, you can build your own system based on inotify.
add a comment |
If you really want to achieve that you can use a file watcher like inotifywait.
You watch a directory and you save information about file creations in separate file outside that directory.
while true; do
change=$(inotifywait -e close_write,moved_to,create .)
change=$change#./ *
if [ "$change" = ".*" ]; then ./scriptToStoreInfoAboutFile; fi
done
As no creation time is stored, you can build your own system based on inotify.
add a comment |
If you really want to achieve that you can use a file watcher like inotifywait.
You watch a directory and you save information about file creations in separate file outside that directory.
while true; do
change=$(inotifywait -e close_write,moved_to,create .)
change=$change#./ *
if [ "$change" = ".*" ]; then ./scriptToStoreInfoAboutFile; fi
done
As no creation time is stored, you can build your own system based on inotify.
If you really want to achieve that you can use a file watcher like inotifywait.
You watch a directory and you save information about file creations in separate file outside that directory.
while true; do
change=$(inotifywait -e close_write,moved_to,create .)
change=$change#./ *
if [ "$change" = ".*" ]; then ./scriptToStoreInfoAboutFile; fi
done
As no creation time is stored, you can build your own system based on inotify.
answered Feb 26 '15 at 16:56
william.eyidiwilliam.eyidi
1,49241932
1,49241932
add a comment |
add a comment |
Cited from https://unix.stackexchange.com/questions/50177/birth-is-empty-on-ext4/131347#131347 , the following shellscript would work to get creation time:
get_crtime() tail -1
add a comment |
Cited from https://unix.stackexchange.com/questions/50177/birth-is-empty-on-ext4/131347#131347 , the following shellscript would work to get creation time:
get_crtime() tail -1
add a comment |
Cited from https://unix.stackexchange.com/questions/50177/birth-is-empty-on-ext4/131347#131347 , the following shellscript would work to get creation time:
get_crtime() tail -1
Cited from https://unix.stackexchange.com/questions/50177/birth-is-empty-on-ext4/131347#131347 , the following shellscript would work to get creation time:
get_crtime() tail -1
edited Apr 13 '17 at 12:36
Community♦
11
11
answered Dec 23 '15 at 19:48
Mike ChenMike Chen
21023
21023
add a comment |
add a comment |
even better:
lsct ()
(read a b;echo -n $a)`'>' `df "$1"
lsct /etc
Wed Jul 20 19:25:48 2016
add a comment |
even better:
lsct ()
(read a b;echo -n $a)`'>' `df "$1"
lsct /etc
Wed Jul 20 19:25:48 2016
add a comment |
even better:
lsct ()
(read a b;echo -n $a)`'>' `df "$1"
lsct /etc
Wed Jul 20 19:25:48 2016
even better:
lsct ()
(read a b;echo -n $a)`'>' `df "$1"
lsct /etc
Wed Jul 20 19:25:48 2016
answered Dec 23 '16 at 11:16
ZibriZibri
4,49722830
4,49722830
add a comment |
add a comment |
Another trick to add to your arsenal is the following:
$ grep -r "Copyright" /<path-to-source-files>/src
Generally speaking, if one changes a file they should claim credit in the “Copyright”. Examine the results for dates, file names, contributors and contact email.
example grep result:
/<path>/src/someobject.h: * Copyright 2007-2012 <creator's name> <creator's email>(at)<some URL>>
add a comment |
Another trick to add to your arsenal is the following:
$ grep -r "Copyright" /<path-to-source-files>/src
Generally speaking, if one changes a file they should claim credit in the “Copyright”. Examine the results for dates, file names, contributors and contact email.
example grep result:
/<path>/src/someobject.h: * Copyright 2007-2012 <creator's name> <creator's email>(at)<some URL>>
add a comment |
Another trick to add to your arsenal is the following:
$ grep -r "Copyright" /<path-to-source-files>/src
Generally speaking, if one changes a file they should claim credit in the “Copyright”. Examine the results for dates, file names, contributors and contact email.
example grep result:
/<path>/src/someobject.h: * Copyright 2007-2012 <creator's name> <creator's email>(at)<some URL>>
Another trick to add to your arsenal is the following:
$ grep -r "Copyright" /<path-to-source-files>/src
Generally speaking, if one changes a file they should claim credit in the “Copyright”. Examine the results for dates, file names, contributors and contact email.
example grep result:
/<path>/src/someobject.h: * Copyright 2007-2012 <creator's name> <creator's email>(at)<some URL>>
edited Mar 8 at 20:56
Rocky Li
3,6761719
3,6761719
answered Mar 8 at 20:17
AxolotiAxoloti
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14842195%2fhow-to-get-file-creation-date-time-in-bash-debian%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Are you using a filesystem that records creation time? Most don't.
– William Pursell
Feb 12 '13 at 21:34
See askubuntu.com/questions/470134/…
– John Red
May 18 '16 at 19:49