Pages

Sunday, August 5, 2012

File Time Stamps


There are many times where we need to find when a file was created, modified or accessed. This can be achieved in linux using ‘stat’ command.

So When we run stat command like ,

[xprk477@omhq13aa ~]$ stat prod
  File: `prod'
  Size: 25096           Blocks: 56         IO Block: 4096   regular file
Device: fd1eh/64798d    Inode: 131774      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 7488/ xprk477)   Gid: ( 1007/     dev)
Access: 2012-08-19 21:41:19.000000000 -0500
Modify: 2012-07-22 22:52:02.000000000 -0500
Change: 2012-07-22 22:52:02.000000000 -0500

The last 3 entries says about the access, modify and change timings of the file. lets see what these say to us

Access (atime): Access Time,  or the last access time of the file. Whenever we accessed, opened or touched the atime is updated to the current time.

Change (ctime): Change time, or last changed time of a file. Whenever we do operations such as changing the ownership or permissions or even the content of the file, the ctime is updated to current time.

Modify (mtime): Modification time, update or modify the content of the file. Modify the ownership or permissions does not change the Time stamp in this case.

Happy leaning , More to Come J