1.任务一
查找/var目录下属主为root并且属组为mail的所有文件 |
[[email protected] ~]# find /var -user root -a -group mail /var/spool/mail /var/spool/mqueue [[email protected] ~]# |
2.任务二
查找/usr目录下不属于root,bin,或zhangfengzhe的文件 |
[[email protected] ~]# find /usr not \( -user root -o -user bin -o -user zhangfengzhe \) |
3.任务三
查找/etc目录下最近一周内内容修改过且不属于root及zhangfengzhe用户的文件 |
[[email protected] ~]# find /etc not \( -user root -o -user zhangfengzhe \) -mtime -7 /etc /etc/group- /etc/blkid /etc/blkid/blkid.tab.old /etc/blkid/blkid.tab /etc/printcap /etc/gshadow /etc/shadow /etc/asound.state /etc/avahi/etc/localtime |
4.任务四
查找当前系统上没有属主或属组且最近1天内曾被访问过的文件,并将其属主属组均修改为root. |
[[email protected] ~]# find . \( -nouser -o -nogroup \) -atime -1 -exec chown root.root {} \; |
5.任务五
查找/etc目录下大于1M的文件,并将其写入/tmp/etc.largefiles文件 |
[[email protected] ~]# find /etc -size +1M -exec echo {} >> /tmp/etc.largefiles \; [[email protected] ~]# cat /tmp/etc.largefiles /etc/selinux/targeted/policy/policy.21 /etc/selinux/targeted/modules/active/base.pp /etc/selinux/targeted/modules/active/base.linked /etc/selinux/targeted/modules/active/policy.kern /etc/gconf/schemas/apps_nautilus_preferences.schemas /etc/gconf/schemas/metacity.schemas /etc/gconf/schemas/gnome-terminal.schemas /etc/gconf/schemas/gok.schemas /etc/gconf/gconf.xml.defaults/%gconf-tree.xml |
或者
[[email protected] ~]# find /etc -size +1M >> /tmp/etc.largefiles |
6.任务六
查找/etc目录下所有用户都没有写权限的文件,显示出其详细信息 |
[[email protected] ~]# find /etc not -perm -222 -exec stat {} \; |
时间: 2024-10-25 05:27:30