作者/来源:yixinu.com
栏目:运维/编程
日期:2012-04-10 07:23:37
查找文件 find
example:
查找/etc目录下用户、同组用户、其实用户权限必须同时匹配为7、5、5的权限、文件大小在2k以下,并且排除权限同时为777的文件,同时使用gawk system函数过虑显示文件的详细信息,再把信息用gawk过虑竖排显示,打印行号。
[root@fedora14 ~]# find /etc -perm -755 -size -2k -not -perm -777 | tail -n 3 | gawk '{system("ls -l "$ 0)}' | gawk '{i=1;while(i<=NF){print $i; i++;} print NR,"==========================="}' -rwxr-xr-x. 1 root root 709 Sep 22 2010 /etc/rc.d/init.d/bluetooth 1 =========================== -rwxr-xr-x. 1 root root 659 Sep 27 2010 /etc/rc.d/init.d/killall 2 =========================== -rwxr-xr-x. 1 root root 220 Mar 29 09:04 /etc/rc.d/rc.local 3 =========================== [root@fedora14 ~]#