linux属于文件的时间,关于linux的文件时间

linux文件时间有三类:

atime (Access time)读取文件或者执行文件时更改的时间

mtime(Modified time)写入文件时随文件内容的更改而更改的时间

ctime (Create time)写入文件、更改所有者、权限或链接设置时随 Inode 的内容更改而更改的。随mtime改变而改变。

那么每回ls -l显示的时间是什么时间哪?

我们使用stat来看看这些时间们:

e.g

[root@monitor test]# stat a

File: `a'

Size: 136             Blocks: 8          IO Block: 4096   regular file

Device: fd00h/64768d    Inode: 3074500     Links: 1

Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2011-03-23 13:36:07.000000000 +0800

Modify: 2011-03-23 13:32:55.000000000 +0800

Change: 2011-03-23 13:32:55.000000000 +0800

[root@monitor test]# ll a

-rw-r--r-- 1 root root 136 Mar 23 13:32 a

我们再做一下以下的操作

[root@monitor test]# chown -R mj.mj a

[root@monitor test]# stat a

File: `a'

Size: 136             Blocks: 8          IO Block: 4096   regular file

Device: fd00h/64768d    Inode: 3074500     Links: 1

Access: (0644/-rw-r--r--)  Uid: (  502/      mj)   Gid: (  503/      mj)

Access: 2011-03-23 13:36:07.000000000 +0800

Modify: 2011-03-23 13:32:55.000000000 +0800

Change: 2011-03-24 10:40:18.000000000 +0800

[root@monitor test]# ll a

-rw-r--r-- 1 mj mj 136 Mar 23 13:32 a

可以清晰的看出ll出来的时间是什么时间。

然后再进行一个操作

[root@monitor test]# touch a

[root@monitor test]# stat a

File: `a'

Size: 136             Blocks: 8          IO Block: 4096   regular file

Device: fd00h/64768d    Inode: 3074500     Links: 1

Access: (0644/-rw-r--r--)  Uid: (  502/      mj)   Gid: (  503/      mj)

Access: 2011-03-24 10:51:35.000000000 +0800

Modify: 2011-03-24 10:51:35.000000000 +0800

Change: 2011-03-24 10:51:35.000000000 +0800

ls -lc filename         列出文件的 ctime

ls -lu filename         列出文件的 atime

ls -l filename          列出文件的 mtime

那这个三个time有什么用?答曰:该用的时候,就会有大用处!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值