LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can i get creation date using ls? (http://www.linuxquestions.org/questions/linux-newbie-8/can-i-get-creation-date-using-ls-4175429336/)

rmknox 09-27-2012 02:33 PM

can i get creation date using ls?
 
F16 32 bit ls GnU 8.12

It appears that ls -l shows me the last modification date.
Is there a way to see the creation date of a file or directory?
Is this info stored in the file system?
If so, how does one access it?

Ive read 'man ls' and 'info ls' but they don't seem to tell

mennohellinga 09-27-2012 02:47 PM

From the ls man page:
Quote:

-l use the long listing format
A long listing of my home directory looks like this:
Code:

[21:44:03 ~]$ ls -l
total 24
-rw-r--r-- 1 mh users  41 Sep 17 12:22 agenda
-rw-r--r-- 1 mh users  56 Sep 27 13:34 authors
-rw-r--r-- 1 mh users  15 Sep 20 18:09 deps
drwxr-xr-x 2 mh users 4096 Sep 20 19:23 Desktop
drwxr-xr-x 8 mh users 4096 Sep 21 20:12 doc
-rw-r--r-- 1 mh users  143 Sep 21 17:23 mnemonic.mm
lrwxrwxrwx 1 mh users  19 Aug 31 00:21 VirtualBox VMs -> doc/VirtualBox VMs/
[21:44:06 ~]$

The output format is
Code:

type permissions owner-user owner-group size-in-bytes month-of-last-edit day-of-last-edit time-of-last-edit filename [-> link address]

rmknox 09-27-2012 02:52 PM

Quote:

Originally Posted by mennohellinga (Post 4790958)
From the ls man page:


A long listing of my home directory looks like this:
Code:

[21:44:03 ~]$ ls -l
total 24
-rw-r--r-- 1 mh users  41 Sep 17 12:22 agenda
-rw-r--r-- 1 mh users  56 Sep 27 13:34 authors
-rw-r--r-- 1 mh users  15 Sep 20 18:09 deps
drwxr-xr-x 2 mh users 4096 Sep 20 19:23 Desktop
drwxr-xr-x 8 mh users 4096 Sep 21 20:12 doc
-rw-r--r-- 1 mh users  143 Sep 21 17:23 mnemonic.mm
lrwxrwxrwx 1 mh users  19 Aug 31 00:21 VirtualBox VMs -> doc/VirtualBox VMs/
[21:44:06 ~]$

Hi menn... - but is this the creation date or the last mod date? I bvelieve it is the last mod date. If so, how do I get the creation date?

The output format is
Code:

type permissions owner-user owner-group size-in-bytes month-of-last-edit day-of-last-edit time-of-last-edit filename [-> link address]

OK - thanks - but isn't this the last mod date? I want the creation date.

Thor_2.0 09-27-2012 02:54 PM

Umm, I hate to break it to you, but as far as I know, you can't it does'nt seem to be stored anywhere. There is a last-modified time (shown by "ls -l"), a last-accessed time (shown by "ls -lu") and an inode change time (shown by "ls -lc")....sorry...

Thor

colucix 09-27-2012 03:07 PM

The ext2/ext3 filesystems don't store the creation time of a file, but the last time at which the inode of the file has been updated. This is called "change time" usually named ctime. It reflects the time of creation until the access permissions or the ownership are not changed. For this reason you cannot trust this timestamp to reveal the creation date of a file. On the contrary the ext4 filesystem adds support for the storage of the true creation date, but as far as I know the libraries and utilities in Linux have not been updated in order to use it.

Regarding your question, you can visualize the "change time" using the stat command or the option -c of ls, e.g.
Code:

$ stat file
  File: `file'
  Size: 0              Blocks: 0          IO Block: 4096  regular empty file
Device: 808h/2056d      Inode: 3146149    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/    alex)  Gid: (  100/  users)
Access: 2012-09-27 21:57:35.189775325 +0200
Modify: 2012-09-27 21:57:35.189775325 +0200

Change: 2012-09-27 22:07:05.726766177 +0200
$ ls -lc file
-rwxr-xr-x 1 alex users 0 Sep 27 22:07 file

keeping in mind it's not a creation date.

Edit: sorry Thor for the redudancy, I didn't see your post before submitting mine.

Thor_2.0 09-27-2012 03:12 PM

hey there, colucix, dont let it get to you, great minds eh? ;) Anyway, it proves the point.

Wellness to all

Thor

rmknox 09-27-2012 03:46 PM

Colucix and Thor - thanks guys - another question
 
Colucix and Thor - thanks guys - in my case I took the defaults when I got onto Fedora f12 and have the logical volume file system (which I would not have picked if I had known) but anyway it is ext4 - thus presumably if I look up the file formats I could write a little utility to see the cration date?

Since you guys obviously know your stuff - maybe you can answer this one

Fedora f16 takes 1 minute longer to boot than my f14 - I see that in the process it created or modifies files and folders as follows:

tmpfs results in creating or updating 13 items with 671.1 MB
sysfs results in creating or updating 20,047 items with 192.5 Mb
proc results in creating or updating 39294 items

I gotta believe this is overkill for a single user desktop system - but dont know where to modify the startup

are there command files that control what happens in startup?

if so where do I read about them?

Thor_2.0 09-27-2012 04:06 PM

Quote:

are there command files that control what happens in startup?
on Arch, these are located in /etc/rc.d/ the script /etc/rc.conf coverns most stuff...
By the way, careful what you wish for ;) if you sc**w up startup scripts, you can basically end up with a dead system :D make backups of any and evertything you touch...

Maybe some info of the wiki can help...
One minute? That's still okay...do realise fedora keeps getting more complex. It's philosophy is different of, say, Arch, where the user controls the show...

Thor
Edit - it may do a fsck on bootup...that takes time too...

rmknox 09-27-2012 04:13 PM

Quote:

Originally Posted by Thor_2.0 (Post 4791008)
on Arch, these are located in /etc/rc.d/ the script /etc/rc.conf coverns most stuff...
By the way, careful what you wish for ;) if you sc**w up startup scripts, you can basically end up with a dead system :D make backups of any and evertything you touch...

Maybe some info of the wiki can help...
One minute? That's still okay...do realise fedora keeps getting more complex. It's philosophy is different of, say, Arch, where the user controls the show...

Thor
Edit - it may do a fsck on bootup...that takes time too...

Super - needless to say I have a backup and a backup of the backup!
Thanks - will look into it

Thor_2.0 09-27-2012 04:30 PM

Quote:

Super - needless to say I have a backup and a backup of the backup!
Wow, we dont need to tell you this! You're an example of how it has to be done, it seems. Most disasters can be avoided this way. I'll follow this thread, maybe I can learn something here :)

Thor

rmknox 09-27-2012 05:02 PM

Quote:

Originally Posted by Thor_2.0 (Post 4791025)
Wow, we dont need to tell you this! You're an example of how it has to be done, it seems. Most disasters can be avoided this way. I'll follow this thread, maybe I can learn something here :)

Thor

Hi THor

I occurred to me to search the web and I found this - out of date but pretty detailed - looks like a good starting point

http://www.yolinux.com/TUTORIALS/Lin...itProcess.html

Thor_2.0 09-27-2012 05:19 PM

Umm...
 
Umm, please tap me on the head :redface: ...this is the very first page (a long while ago) I found and learned about bootup...I should have given you this URL instead...I need to re-organise my bookmarks. Dated, perhaps, educational, yes.

Thanks for sharing this link!!!

Thor


All times are GMT -5. The time now is 02:34 AM.