在Linux操作系统中,每个文件都有很多的时间参数,其中有三个比较主要,分别是ctime,atime,mtime

atime 最后一次访问时间, 如 ls, more 等, 但 chmod, chown, ls, stat 等不会修改些时间, 使用 ls -utl 可以按此时间顺序查看;
ctime 最后一次状态修改时间, 如 chmod, chown 等状态时间改变但修改时间不会改变, 使用 stat file 可以查看;
mtime 最后一次内容修改时间, 如 vi 保存后等, 修改时间发生改变的话, atime 和 ctime 也相应跟着发生改变

-ctime -n 查找距现在 n*24H 内修改过的文件
-ctime n 查找距现在 n*24H 前, (n+1)*24H 内修改过的文件
-ctime +n 查找距现在 (n+1)*24H 前修改过的文件

常用范例:
-- 查找两天前修改过的文件:
find . -type f -mtime -2

-- 查找3天内修改过的文件:
find -ctime -3

-- 删除/data/backup目录下状态修改时间超过6天的文件:
find /data/backup -ctime +6 -exec rm -f {} \;

-- 删除/data/backup目录下空的文件夹,同时输出正确和错误信息到空:
find /data/backup -type d -empty -exec rmdir {} \; >/dev/null 2>&1

-- 查找超过6天且是空文件的find命令:
find ./ -type d -empty -ctime +6

-- 查找/home/admin目录下修改时间在1天之内的文件
find /home/admin -mtime -1

-- 查找/home/admin目录下修改时间在1天之内的文件名为.txt结尾的文件
find /home/admin -name *.txt -mtime -1

Linux之 find之 ctime,atime,mtime的更多相关文章

  1. 【Linux常识篇(3)】文件及文件夹的ctime atime mtime的含义详解

    首先可以使用stat 命令来查询文件的inode信息,其中包括ctime atime mtime [root@localhost ~]# stat sort2.txt File: 'sort2.txt ...

  2. Linux的find命令实例详解和mtime ctime atime

    这次解释一下三个Linux文件显示的三个时间,然后展示一下find命令的各个功能 在linux操作系统中,每个文件都有很多的时间参数,其中有三个比较主要,分别是ctime,atime,mtime mo ...

  3. atime,mtime,ctime 的理解

    Linux之atime,mtime,ctime from:http://blog.sina.com.cn/s/blog_5980699f0100zkgz.html 首先可以使用stat 命令来查询文件 ...

  4. linux中文件的三种time(atime,mtime,ctime)

    linux下文件有3个时间的,分别是atime,mtime,ctime.有些博友对这3个时间还是比较迷茫和困惑的,我整理了下,写下来希望对博友们有所帮助. 1 这三个time的含义 简名 全名 中文名 ...

  5. Linux文件时间详解ctime、mtime、atime【转】

    本文转载自:http://blog.csdn.net/doiido/article/details/43792561 Linux系统文件有三个主要的时间属性,分别是 ctime(change time ...

  6. [转帖]Linux中的find(-atime、-ctime、-mtime)指令分析

    Linux中的find(-atime.-ctime.-mtime)指令分析 https://www.cnblogs.com/zhangjinjin01/p/5505970.html https://w ...

  7. Linux - 文件的三种时间之atime、ctime、mtime的区别和简单用法

    在Linux中,文件或者目录中有三个时间属性 atime ctime mtime 简名 全名 中文 作用 atime Access Time 访问时间 最后一次访问文件(读取或执行)的时间 ctime ...

  8. linux 下mtime,ctime,atime分析

    一.atime.ctime与mtime atime是指access time,即文件被读取或者执行的时间,修改文件是不会改变access time的.网上很多资料都声称cat.more等读取文件的命令 ...

  9. linux中文件的时间属性atime/mtime/ctime

    文件的时间属性的概念 上图第7-9是时间,默认是ctime(文件修改时间),有三种时间属性: modify time        mtime       (文件内容被修改的时间) change ti ...

随机推荐

  1. hdu3863找规律

    先画一下N=2的情况,先手胜,再画一下N=3的情况,先手胜,所以大胆的猜测,无论N=多少,先手胜!! 这也能A真是个奇迹 #include<map> #include<set> ...

  2. 我的 VSCode 常用扩展

    Beautify (option+shift+F) Bookmarks (option+option+k,l,j) Debugger for Chrome Docker EditorConfig fo ...

  3. 2-6-搭建FTP服务器实现文件共享

    ---------------------------------------------- 大纲: FTP服务:(文件传输协议---> File Transfer Protocol) 常见FT ...

  4. day37 爬虫2(web微信、高性能相关、Scrapy)

    s16day37 爬虫2 参考博客:http://www.cnblogs.com/wupeiqi/articles/6229292.html 课堂代码:https://github.com/liyon ...

  5. 【Windows】netsh动态配置端口转发

    文章转载自傲风 使用多个虚拟机,将开发环境和工作沟通环境分开(即时通,办公系统都只能在windows下使用-),将开发环境的服务提供给外部访问时,需要在主机上通过代理配置数据转发. VirtualBo ...

  6. 【hive】null值判断

    hive用作null值的判断是不能用 = , != 来判断的 只能用is [not] null来完成 不支持ifnull()函数(mysql支持) 适用于所有数据类型 (1)条件中判断是否为空 whe ...

  7. Alpha冲刺一 (2/10)

    前言 队名:拖鞋旅游队 组长博客:https://www.cnblogs.com/Sulumer/p/9960487.html 作业博客:https://edu.cnblogs.com/campus/ ...

  8. Git 配置ssh key的步骤

    First start by setting up your own public/private key pair set. This can use either DSA or RSA, so b ...

  9. gradle Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.crea

    gradle Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.crea ...

  10. Android 开发 Tip 17 -- 为什么getBackground().setAlpha(); 会影响别的控件?

    转载请注明出处:http://blog.csdn.net/crazy1235/article/details/75670018 http://www.jb51.net/article/110035.h ...