Linux文件搜索-find

来源:互联网 发布:日本演员关口知宏 编辑:程序博客网 时间:2024/06/08 03:52

文件搜索命令:find




[root@localhost 桌面]# find /etc/ -name init/etc/sysconfig/init/etc/init/etc/kdump-adv-conf/kdump_initscripts/init[root@localhost 桌面]# find /etc/ -name *init*  #*是通配符  默认是准确搜索/etc/selinux/targeted/contexts/initrc_context/etc/sysconfig/network-scripts/init.ipv6-global/etc/sysconfig/init/etc/rc.d/init.d/etc/rc.d/rc.sysinit/etc/festival/siteinit.scm/etc/X11/xinit/etc/X11/xinit/xinitrc-common/etc/X11/xinit/xinitrc.d/etc/X11/xinit/xinitrc/etc/init/etc/init/init-system-dbus.conf/etc/inittab/etc/kdump-adv-conf/kdump_initscripts/etc/kdump-adv-conf/kdump_initscripts/init/etc/kdump-adv-conf/kdump_initscripts/kdumpinit.rootfs/etc/security/namespace.init/etc/init.d/etc/pam.d/run_init/etc/rc.sysinit[root@localhost 桌面]# find /etc/ -name init???   #?匹配单个字符/etc/inittab[root@localhost 桌面]# find /etc/ -iname init???   #-iname 忽略大小写/etc/inittab[root@localhost 桌面]# find / -size +204800 #+代表大于多少 - 代表少于多少数据块 不写代表等于多少数据块  在linux下一个数据快代表512个字节=== 0.5Kfind: “/proc/3204/task/3204/fd/5”: 没有那个文件或目录find: “/proc/3204/task/3204/fdinfo/5”: 没有那个文件或目录find: “/proc/3204/fd/5”: 没有那个文件或目录find: “/proc/3204/fdinfo/5”: 没有那个文件或目录/var/cache/yum/x86_64/6/updates/5cd7d9db9614f922690bd74799d15db26d1f27136b26ace8c868cce15f3cf8fe-other.sqlite/sys/devices/pci0000:00/0000:00:0f.0/resource1/sys/devices/pci0000:00/0000:00:0f.0/resource1_wc[root@localhost 桌面]# find /home -user jiangyi # 寻找属于用户jiangyi的文件


[root@localhost 桌面]# find /home/ -amin -5 #amin代表最后访问时间在五分钟类 cmin  代表文件属性在5分钟内修改过  mmin代表文件内容在5分钟内被修改过/home/jiangyi/home/jiangyi/.gconfd/saved_state/home/jiangyi/.bash_profile/home/jiangyi/.xsession-errors/home/jiangyi/.dmrc/home/jiangyi/.recently-used.xbel/home/jiangyi/.local/share/gvfs-metadata/computer:-d9415298.log/home/jiangyi/.local/share/gvfs-metadata/root-99d14257.log/home/jiangyi/.local/share/gvfs-metadata/home-1b9d1c30.log/home/jiangyi/.local/share/gvfs-metadata/home/home/jiangyi/.local/share/gvfs-metadata/root/home/jiangyi/.local/share/gvfs-metadata/computer:/home/jiangyi/.local/share/Trash/files/home/jiangyi/.local/share/Trash/info/home/jiangyi/.local/share/Trash/info/桌面.trashinfo/home/jiangyi/.gnome2/accels/gedit/home/jiangyi/.gnome2/gedit/gedit-2/home/jiangyi/.bash_logout/home/jiangyi/.cache/gedit/gedit-metadata.xml/home/jiangyi/.cache/ibus/pinyin/user-1.3.db/home/jiangyi/.cache/ibus/pinyin/user-1.3.db-journal/home/jiangyi/.esd_auth/home/jiangyi/.gconf/apps/gedit-2/preferences/ui/statusbar/%gconf.xml




[root@localhost 桌面]# find /etc/ -name init* -a -size -204800 -exec ls -l  {} \;-rw-r--r--. 1 root root 30 2月  22 2013 /etc/selinux/targeted/contexts/initrc_context-rwxr-xr-x. 1 root root 4623 1月   9 2013 /etc/sysconfig/network-scripts/init.ipv6-global-rw-r--r--. 1 root root 1154 2月  22 2013 /etc/sysconfig/init总用量 392-rwxr-xr-x. 1 root root  1288 2月  23 2013 abrt-ccpp-rwxr-xr-x. 1 root root  1628 2月  23 2013 abrtd-rwxr-xr-x. 1 root root  1642 2月  23 2013 abrt-oops-rwxr-xr-x. 1 root root  1725 8月  19 2010 acpid-rwxr-xr-x. 1 root root  2062 1月  30 2012 atd-rwxr-xr-x. 1 root root  3378 6月  22 2012 auditd-rwxr-xr-x. 1 root root  4043 2月  22 2013 autofs-r-xr-xr-x. 1 root root  1340 2月  22 2013 blk-availability-rwxr-xr-x. 1 root root   710 11月 11 2010 bluetooth-rwxr-xr-x. 1 root root  2094 2月  22 2013 certmonger-rwxr-xr-x. 1 root root 11403 2月  22 2013 cpuspeed-rwxr-xr-x. 1 root root  2793 7月  19 2011 crond-rwxr-xr-x. 1 root root  3034 11月 21 2012 cups-rwxr-xr-x. 1 root root  1702 2月  22 2013 dnsmasq-rwxr-xr-x. 1 root root  3245 11月  7 2012 firstboot-rw-r--r--. 1 root root 18216 1月   9 2013 functions-rwxr-xr-x. 1 root root  1801 7月  20 2011 haldaemon-rwxr-xr-x. 1 root root  5829 1月   9 2013 halt-rwxr-xr-x. 1 root root  2001 2月  22 2013 htcacheclean-rwxr-xr-x. 1 root root  3371 2月  22 2013 httpd-rwxr-xr-x. 1 root root  9515 2月  22 2013 ip6tables-rwxr-xr-x. 1 root root  9409 2月  22 2013 iptables-rwxr-xr-x. 1 root root  1908 10月 13 2012 irqbalance-rwxr-xr-x. 1 root root 16034 2月  22 2013 kdump-rwxr-xr-x. 1 root root   652 1月   9 2013 killall-r-xr-xr-x. 1 root root  2134 2月  22 2013 lvm2-lvmetad-r-xr-xr-x. 1 root root  2665 2月  22 2013 lvm2-monitor-rwxr-xr-x. 1 root root  2571 12月  7 2012 mdmonitor-rwxr-xr-x. 1 root root  2200 9月  14 2012 messagebus-rwxr-xr-x. 1 root root  2989 1月   9 2013 netconsole-rwxr-xr-x. 1 root root  5486 1月   9 2013 netfs-rwxr-xr-x. 1 root root  6334 1月   9 2013 network-rwxr-xr-x. 1 root root  2205 2月  22 2013 NetworkManager-rwxr-xr-x. 1 root root  6340 2月  22 2013 nfs-rwxr-xr-x. 1 root root  3526 2月  22 2013 nfslock-rwxr-xr-x. 1 root root  1923 1月  10 2013 ntpd-rwxr-xr-x. 1 root root  1866 1月  10 2013 ntpdate-rwxr-xr-x. 1 root root  2261 6月  25 2011 oddjobd-rwxr-xr-x. 1 root root  2023 4月   3 2012 portreserve-rwxr-xr-x. 1 root root  3852 12月  3 2011 postfix-rwxr-xr-x. 1 root root  1556 7月  17 2012 psacct-rwxr-xr-x. 1 root root  2034 10月  2 2012 quota_nld-rwxr-xr-x. 1 root root  1559 5月  20 2009 rdisc-rwxr-xr-x. 1 root root  1822 2月  22 2013 restorecond-rwxr-xr-x. 1 root root  1808 12月 18 2011 rngd-rwxr-xr-x. 1 root root  2073 2月  22 2013 rpcbind-rwxr-xr-x. 1 root root  2518 2月  22 2013 rpcgssd-rwxr-xr-x. 1 root root  2300 2月  22 2013 rpcidmapd-rwxr-xr-x. 1 root root  2464 2月  22 2013 rpcsvcgssd-rwxr-xr-x. 1 root root  2011 1月  10 2013 rsyslog-rwxr-xr-x. 1 root root  1698 2月  22 2013 sandbox-rwxr-xr-x. 1 root root  2056 11月 20 2012 saslauthd-rwxr-xr-x. 1 root root   647 1月   9 2013 single-rwxr-xr-x. 1 root root  3002 2月  22 2013 smartd-rwxr-xr-x. 1 root root  2162 2月  22 2013 snmpd-rwxr-xr-x. 1 root root  1738 2月  22 2013 snmptrapd-rwxr-xr-x. 1 root root  2472 2月  22 2013 spice-vdagentd-rwxr-xr-x. 1 root root  4534 2月  22 2013 sshd-rwxr-xr-x. 1 root root  2647 2月  23 2013 sssd-rwxr-xr-x. 1 root root  1228 6月  22 2012 sysstat-rwxr-xr-x. 1 root root  2294 2月  22 2013 udev-post-rwxr-xr-x. 1 root root 39800 9月  12 11:04 vmware-tools-rwxr-xr-x. 1 root root 15208 9月  12 11:04 vmware-tools-thinprint-rwxr-xr-x. 1 root root  1674 2月  22 2013 wdaemon-rwxr-xr-x. 1 root root  1608 2月  22 2013 winbind-rwxr-xr-x. 1 root root  1866 2月   4 2013 wpa_supplicant-rwxr-xr-x. 1 root root  4799 2月  22 2013 ypbind总用量 68-rw-r--r--. 1 root root  260 1月   9 2013 control-alt-delete.conf-rw-r--r--. 1 root root  130 6月  22 2012 init-system-dbus.conf-rw-r--r--. 1 root root  316 1月   9 2013 kexec-disable.conf-rw-r--r--. 1 root root  409 1月   9 2013 plymouth-shutdown.conf-rw-r--r--. 1 root root  217 1月   9 2013 prefdm.conf-rw-r--r--. 1 root root  358 1月   9 2013 quit-plymouth.conf-rw-r--r--. 1 root root  281 1月   9 2013 rc.conf-rw-r--r--. 1 root root  909 1月   9 2013 rcS.conf-rw-r--r--. 1 root root  283 1月   9 2013 rcS-emergency.conf-rw-r--r--. 1 root root  580 1月   9 2013 rcS-sulogin.conf-rw-r--r--. 1 root root 2915 8月  23 2010 readahead-collector.conf-rw-r--r--. 1 root root 1559 8月  23 2010 readahead.conf-rw-r--r--. 1 root root  726 8月  23 2010 readahead-disable-services.conf-rw-r--r--. 1 root root 1162 1月   9 2013 serial.conf-rw-r--r--. 1 root root  643 1月   9 2013 splash-manager.conf-rw-r--r--. 1 root root  329 1月   9 2013 start-ttys.conf-rw-r--r--. 1 root root  198 1月   9 2013 tty.conf-rw-r--r--. 1 root root 130 6月  22 2012 /etc/init/init-system-dbus.conf-rw-r--r--. 1 root root 884 9月  12 18:36 /etc/inittab-rwxr-xr-x. 1 root root 4781 10月 29 2009 /etc/kdump-adv-conf/kdump_initscripts/initlrwxrwxrwx. 1 root root 11 9月  12 18:14 /etc/init.d -> rc.d/init.d[root@localhost 桌面]# find /etc/ -name init* -a -size -204800 -ok  ls -l  {} \;< ls ... /etc/selinux/targeted/contexts/initrc_context > ? y-rw-r--r--. 1 root root 30 2月  22 2013 /etc/selinux/targeted/contexts/initrc_context< ls ... /etc/sysconfig/network-scripts/init.ipv6-global > ? n< ls ... /etc/sysconfig/init > ? ^C[root@localhost 桌面]# ^C

[root@localhost 桌面]# find /home/jiangyi/ -type l/home/jiangyi/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/langpack-zh-CN@firefox.mozilla.org.xpi/home/jiangyi/.pulse/a985f3179da318f56a10bda40000001b-runtime[root@localhost 桌面]# ls -l总用量 4drwxrwxr-x. 5 jiangyi jiangyi 4096 9月  12 11:18 cheat-master-rw-r--r--. 1 jiangyi jiangyi    0 9月  18 13:58 index.txt~[root@localhost 桌面]# ls -i793092 cheat-master  793647 index.txt~[root@localhost 桌面]# find . -inum 793647 -ok rm {} \;< rm ... ./index.txt~ > ? y[root@localhost 桌面]# 



[root@localhost 桌面]# #find -name  -iname ? * -size + -  -user -group -amin -cmin -mmin -type f d l - inum  -a -o  -exec {} \; -ok exec {} \;




0 0
原创粉丝点击