วันจันทร์ที่ 30 สิงหาคม พ.ศ. 2553

mtime, ctime, and atime timestamp Linux

Recently, I've implemented a caching system. This involve removing old file from the cache. One important factor for making a decision is a file timestamp. There are many timestamp implemented in the file system here are method for viewing timestamp info.

mtime, ctime, and atime

atime - access time
mtime - if modify time
ctime - of change time

To view atime

ls -lu

To view ctime

ls -lc

To view mtime

ls -lt

Access time is when last time data from the file was access.

Modify time is when last change was done to the file.

Change time id when you change owner.

Or

Use stat command

stat filename

stat newname2.txt
File: `newname2.txt'
Size: 13 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 2338058 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2011-01-28 16:01:10.000000000 +0700
Modify: 2011-01-28 16:02:35.000000000 +0700
Change: 2011-01-28 16:06:26.000000000 +0700

to verify with ls command
--
References :

ไม่มีความคิดเห็น:

แสดงความคิดเห็น