曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 4851|回复: 0
打印 上一主题 下一主题

ctime,mtime,atime

[复制链接]

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34387
跳转到指定楼层
楼主
发表于 2009-1-5 03:37:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
mtime : modification time
ctime  :  status time
atime  :  access time

先看一下 pass.txt 这个文件的 ctime
[beyes@localhost ~]$ ls -l --time=ctime pass.txt
-rw-rw-r-- 1 beyes beyes 154 01-05 02:14 pass.txt

改变一下文件的属性后再看看:
[beyes@localhost ~]$ chmod 755 pass.txt
[beyes@localhost ~]$ ls -l --time=ctime pass.txt
-rwxr-xr-x 1 beyes beyes 154 01-05 03:32 pass.txt

从上面看到,文件的属性改变了,这个 ctime 也就发生了变化。

看一下这个文件的 mtime
[beyes@localhost ~]$ ls -l pass.txt
-rwxr-xr-x 1 beyes beyes 154 01-05 02:14 pass.txt

现在修改一下 pass.txt 中的内容:
[beyes@localhost ~]$ ls -l pass.txt
-rwxr-xr-x 1 beyes beyes 161 01-05 03:36 pass.txt

再看一下 atime:
[beyes@localhost ~]$ ls -l --time=atime pass.txt
-rwxr-xr-x 1 beyes beyes 161 01-05 03:36 pass.txt

三分钟后,用 cat 命令来查看一下文件然后再看看 atime:
[beyes@localhost ~]$ cat pass.txt
yes:no:hi:hello:maybe:welcome

ok:awk:bird:amd:tmd:intel:ati

name:linux:unix:gnu:bsd:open
suse:ubuntu:fedora:redhat:now
china:usa:korea:japan:enland:old

mtime
[beyes@localhost ~]$ ls -l --time=atime pass.txt
-rwxr-xr-x 1 beyes beyes 161 01-05 03:39 pass.txt
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-5-19 17:49 , Processed in 0.059504 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表