美文网首页
linux 查找02

linux 查找02

作者: 小小机器人 | 来源:发表于2016-12-04 23:01 被阅读24次
find

时间相关
-mtime : 指定时间段被修改过的文件
-ctime : 指定时间段被修改文件状态的文件
-atime : 指定时间段被访问过的文件

  • -amin n 在n分钟之前的那一分钟
  • -cmin -n 在n分钟之内
  • -mmin +n 在n分钟之前
  • -atime n 在n*24小时前的那24小时
[root@localhost /]# find / -atime 1 #查找距离现在24小时前的那24小时内访问过的文件
  • -ctime -n n*24小时前到现在
[root@localhost /]# find / -ctime -1 #查找距现在1*24小时前到现在修改过文件权限的文件(其实==-mtime 0)
  • -mtime +n 在n*24小时前的时间内
[root@localhost /]# find / -mtime +2 #查找距现在2*24小时前修改过的文件```

***用户/组相关***
-user:所属主的文件
-nouser:没有所属组的文件
-group:所属组的文件

***其他***
-name 按文件全名查找(也可以写成通配符格式)
-iname 按文件全名查找(不区分大小写)
-type 按文件类型查找(f:file l:link d:dir)
-size n(文件大小为nk)/+n(文件大小大于nk)

[root@localhost /]# find / -iname file -type f -size 0
/proc/filesystems
/proc/sys/fs/file-nr
/proc/sys/fs/file-max
/tmp/myfile



>######grep

[testuser@localhost test]$ pwd
/home/testuser/test
[testuser@localhost test]$ ll
总用量 4
-rw-rw-r--. 1 testuser testuser 63 12月 13 02:45 test.txt
[testuser@localhost test]$ cat test.txt
This is Test File
a b c d e
1 2 3 4 5
pangxie yungou jishu bu

相关文章

网友评论

      本文标题:linux 查找02

      本文链接:https://www.haomeiwen.com/subject/iutkmttx.html