atime ctime and mtime

atime: Access time
ctime: Change time (All changes including file permissions)
mtime: modified time (File content changes only)

Demonstration:

1. Create the empty file: $touch testfile
2. List it’s 3 times: all 3 times are same.
$ stat –format=’AT:%x MT:%y CT:%z’ testfile
AT :2018-01-18 16:49:41.888538164 +0000
MT:2018-01-18 16:49:41.888538164 +0000
CT :2018-01-18 16:49:41.888538164 +0000

3.touch file again $ touch testfile – it updated all 3 times
$ stat –format=’AT:%x MT:%y CT:%z’ testfile
AT :2018-01-18 16:51:17.911062055 +0000
MT:2018-01-18 16:51:17.911062055 +0000
CT:2018-01-18 16:51:17.911062055 +0000

4. Update file content
echo “sample” > testfile
$stat –format=’AT:%x MT:%y CT:%z’ testfile
AT :2018-01-18 16:51:39.003957564 +0000 –> not updated
MT:2018-01-18 16:52:27.125719302 +0000 –> updated
CT :2018-01-18 16:52:27.125719302 +0000 –> updated

5. Change permissions (inode update, file content same)
$chmod u+x newfile
$ stat –format=’AT:%x MT:%y CT:%z’ testfile
AT:2018-01-19 00:26:49.948206613 +0000
MT:2018-01-19 00:26:49.948206613 +0000
CT:2018-01-19 00:28:03.607859122 +0000 –> updated

Advertisements

Author: rajukv

Hadoop(BigData) Architect and Hadoop Security Architect can design and build hadoop system to meet various data science projects.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s