2.25-find命令(下)-mmin -size -exec属性

给test2.txt做个硬链接

[root@evan-01 ~]# touch test2.txt
[root@evan-01 ~]# ll
total 16
-rw-------. 1 root root  6398 Aug  8 16:10 anaconda-ks.cfg
-rw-------. 1 root root  1257 Aug  8 18:36 anaconda-ks.cfg.bak
drwxrwxr--. 5 root evan1  105 Aug 12 10:59 test
drwxr-xr-x. 2 root root    37 Aug 12 10:59 test2
-rw-rw-r--. 1 root root     0 Aug  9 11:40 test2_heard.txt
-rw-r--r--. 1 root root     0 Aug 13 10:36 test2.txt
lrwxrwxrwx. 1 root root     9 Aug 12 11:28 test3_soft.txt -> test3.txt
-rwx------. 1 root root    15 Aug 13 10:22 test3.txt
[root@evan-01 ~]# ln test2.txt /tmp/test2.txt.bak
[root@evan-01 ~]# ls -li test2.txt
33881208 -rw-r--r--. 2 root root 0 Aug 13 10:36 test2.txt
[root@evan-01 ~]#

按inode号查找硬链接

[root@evan-01 ~]# find / -inum 33881208
/root/test2.txt
/tmp/test2.txt.bak
[root@evan-01 ~]# 

mmin 按分钟查找
如果觉得查一天以内还不够具体的话,就可以按分钟查找(60分钟)

[root@evan-01 ~]# find /root/ -type f -mmin -60
/root/test3.txt
/root/test2.txt
[root@evan-01 ~]# ls -l /root/test3.txt 
-rwx------. 1 root root 15 Aug 13 10:22 /root/test3.txt
[root@evan-01 ~]# ls -l /root/test2.txt  
-rw-r--r--. 2 root root 0 Aug 13 10:36 /root/test2.txt
[root@evan-01 ~]# date
Tue Aug 13 10:40:38 CST 2019

按分钟查找,并且列出查到的文件的详细信息

[root@evan-01 ~]# find /root/ -type f -mmin -120 -exec ls -l {} \;
-rwx------. 1 root root 15 Aug 13 10:22 /root/test3.txt
-rw-r--r--. 2 root root 0 Aug 13 10:36 /root/test2.txt
[root@evan-01 ~]# 


按分钟查找,并且批量更改文件名字

[root@evan-01 ~]# find /root/ -type f -mmin -120 -exec mv {} {}.bak \;
[root@evan-01 ~]# find /root/ -type f -mmin -120
/root/test3.txt.bak
/root/test2.txt.bak
[root@evan-01 ~]# 

按文件大小查找(k/M)

[root@evan-01 ~]#  find /home/ -size -10M   
/home/
/home/evan1
/home/evan1/.bash_logout
/home/evan1/.bash_profile
/home/evan1/.bashrc
/home/evan1/.bash_history
/home/evan2
/home/evan2/.bash_logout
/home/evan2/.bash_profile
/home/evan2/.bashrc
/home/evan2/.bash_history
/home/shell
/home/shell/.log
/home/shell/1.sh
/home/shell/2019-08-09.log
/home/shell/1.log
[root@evan-01 ~]# 

详细查看下

[root@evan-01 ~]#  find /home/ -type f  -size -10M -exec ls -lh {} \;
-rw-r--r--. 1 evan1 evan1 18 Aug  3  2017 /home/evan1/.bash_logout
-rw-r--r--. 1 evan1 evan1 193 Aug  3  2017 /home/evan1/.bash_profile
-rw-r--r--. 1 evan1 evan1 231 Aug  3  2017 /home/evan1/.bashrc
-rw-------. 1 evan1 evan1 352 Aug 12 10:39 /home/evan1/.bash_history
-rw-r--r--. 1 evan2 evan2 18 Aug  3  2017 /home/evan2/.bash_logout
-rw-r--r--. 1 evan2 evan2 193 Aug  3  2017 /home/evan2/.bash_profile
-rw-r--r--. 1 evan2 evan2 231 Aug  3  2017 /home/evan2/.bashrc
-rw-------. 1 evan2 evan2 257 Aug 12 10:40 /home/evan2/.bash_history
-rw-rw-r--. 1 root root 441 Aug  9 16:37 /home/shell/.log
-rw-rw-r--. 1 root root 46 Aug  9 16:38 /home/shell/1.sh
-rw-rw-r--. 1 root root 441 Aug  9 16:38 /home/shell/2019-08-09.log
-rw-r--r--. 1 root root 811 Aug 12 15:56 /home/shell/1.log
[root@evan-01 ~]# 
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值