查找/etc地下以rc开头的,然后对这些文件执行ls -l,其中-type是查找的设备的类型,-type f即为查找普通设备
find可以对结果进行两种处理,1.打印,后面跟print 2.直接对查找出来的文件进行处理
1.find /etc/ -type f -name "sh" -print
2.find /etc/ -type f -name "rc" -exec ls -l {} ;
3.find /etc/ -type f -name "rc" -ok ls -l {} ;
[root@oraclehost ~]# find /etc/ -type f -name "sh" -print
/etc/shadow-
/etc/profile.d/sh.local
/etc/shadow
/etc/shells
/etc/sane.d/sharp.conf
[root@oraclehost ~]#
[root@oraclehost ~]# find /etc/ -type f -name "rc*" -exec ls -l {} ;//对查找出来的结果做处理
-rw-r--r--. 1 root root 473 Oct 2 2020 /etc/rc.d/rc.local
[root@oraclehost ~]# find /etc/ -type f -name "sh*" -ok ls -l {} ;//对查找的结果一条一条交互式的做处理,需要确认后才会执行
< ls ... /etc/shadow- > ? y
----------. 1 root root 1640 Sep 1 09:42 /etc/shadow-
< ls ... /etc/profile.d/sh.local > ? y
-rw-r--r--. 1 root root 81 Apr 1 2020 /etc/profile.d/sh.local
< ls ... /etc/shadow > ? y
---------- 1 root root 1614 Sep 1 09:42 /etc/shadow
< ls ... /etc/shells > ? y
-rw-r--r--. 1 root root 63 Jul 18 10:25 /etc/shells
< ls ... /etc/sane.d/sharp.conf > ? y
-rw-r--r-- 1 root root 1464 Oct 31 2018 /etc/sane.d/sharp.conf
浙公网安备 33010602011771号