Wednesday, April 16, 2008

Find Access,Modify,Change Time,Inode of a file - stat command


Inode number of a file can be found from ls output itself.

$ ls -i

e.g.

$ ls -i ch.sh
6127772 ch.sh

All statistics like Access Time,Modify Time,Change Time,Inode number etc are given by stat command:

$ stat ch.sh
File: `ch.sh'
Size: 182 Blocks: 8 IO Block: 4096 regular file
Device: 803h/2051d Inode: 6127772 Links: 1
Access: (0644/-rw-r--r--) Uid: (27357/ jsaikia) Gid: ( 600/ staff)
Access: 2008-04-16 11:26:37.800868721 +0530
Modify: 2008-04-15 12:36:19.342458624 +0530
Change: 2008-04-15 12:36:19.344458539 +0530


Difference between Modify Time and Change Time:
---------------------------------------------------

You might be wondering, whats the difference between Change Time and Modify Time of a file as shown by stat.

Change Time: If you change permission,ownership, rename the file etc, this time gets affected.

Modify Time: If you change the contents, Modify time will change (This has a affect to change Access,Change Time as well)

No comments:

© Jadu Saikia www.UNIXCL.com