find 命令基础练习

练习1 查找/tmp下,不是目录,并且还不能是套接字类型的文件
find /tmp -not -type d -a -not -type s -ls
练习2 /tmp/test 目录下,属主即不是user1 ,也不是user2的文件
find /tmp/test -not ( -user user1 -o -user user2 ) -ls
练习 3 查找/var目录下属主为rott并且属组为mail的所有文件
find /var -user root -group mail -ls
练习4 查找/usr 目录下不属于root ,bin 或student的文件
find /usr -not -user root -a -not -user bin -a -not -user student
find /user -not ( -user root -o -user bin -o -user student )
练习 5 查找/etc/目录下最近一周内内容修改改过且不属于root及student用户的文件
find /etc -mtime -7 -a -not ( -user root -o -user student ) -ls
练习 6 查找当前系统上没有属主或者没有属组且最近一天内曾被访问过的文件,并将其属主属组均修改为root
find / -atime -1 -a -nouser -o -nogroup -exec chown root.root {} \;
练习 7 查/etc目录下大于1M的文件,并将其文件名写入/tmp/etc.largefiles文件中;
find /etc -size +1M >> /tmp/largefile.txt
练习8 查找/etc/目录下所有用户都没有写权限的文件,显示出其详细信息;
find /etc -not -perm /222 -ls

转载于:https://blog.51cto.com/ahtao/2047895

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值