find常用参数详解
Posted 尹正杰
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了find常用参数详解相关的知识,希望对你有一定的参考价值。
Linux操作系统的文件查找工具locate和find命令常用参数介绍
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.非实时查找(数据库查找)locate工具
locate命令的工作原理剖析:
用locate命令在搜索文件列表的时候,它并不是去硬盘中实时搜索文件,而是事先把磁盘上的所有文件预建文件索引数据库(即"/var/lib/mlocate.db"),查询时依赖于事先构建的索引(索引的构建是在系统较为空闲时自动进行,即周期性任务),这就是为什么它搜索文件非常快的原因。
但这并不是说安装操作系统或者刚刚安装完locate软件,就会立即有"/var/lib/mlocate.db"数据库的,而是需要等待一段时间后它才会自动生成,而这个等待时间是不确定的,因此我们可以使用update命令来手动生成该索引数据库文件。
索引构建过程需要遍历整个根文件系统,极消耗资源,因此locate命令适合搜索比较稳定的文件,比如系统的启动脚本或系统配置文件之类的,因为他们不仅经常变化,基本上都可以搜索到,但是对于一些变化频率比较高的文件搜索起来locate就有点力不从心,需要咱们不断地手动更新数据库才能获取到最新的文件索引信息。
locate命令的工作特点:
(1)查找速度快
(2)模糊查找
(3)非实时查找
(4)搜索的文件是全路径,不仅仅是文件名
(5)可能之搜索用户具备读取和执行权限的目录
locate语法格式:
Usage: locate [OPTION]... [PATTERN]...
常用选项:
-i:
不区分大小写。
-n N:
只例举前N个匹配项目。
-r:
使用正则biao a
1>.安装locate数据库(最小化操作系统是没有安装locate命令的哟~)
[root@node101.yinzhengjie.org.cn ~]# yum -y install mlocate Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Resolving Dependencies --> Running transaction check ---> Package mlocate.x86_64 0:0.26-8.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================= Installing: mlocate x86_64 0.26-8.el7 base 113 k Transaction Summary ================================================================================================================================= Install 1 Package Total download size: 113 k Installed size: 379 k Downloading packages: mlocate-0.26-8.el7.x86_64.rpm | 113 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mlocate-0.26-8.el7.x86_64 1/1 Verifying : mlocate-0.26-8.el7.x86_64 1/1 Installed: mlocate.x86_64 0:0.26-8.el7 Complete! [root@node101.yinzhengjie.org.cn ~]#
2>.更新locate的数据库文件
[root@node101.yinzhengjie.org.cn ~]# locate hosts #我们在安装locate命令时并不会立即生成数据索引文件。 locate: can not stat () `/var/lib/mlocate/mlocate.db\': No such file or directory [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# updatedb #因此我们可以手动locate命令的数据库文件,如果文件已经存在则更新该数据库内容。 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll /var/lib/mlocate/mlocate.db #数据库文件竟然自动创建出来啦 -rw-r----- 1 root slocate 2483967 Dec 12 09:15 /var/lib/mlocate/mlocate.db [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# touch f1.log #我们此处创建一个文件 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# ll #该文件已经创建出来来 total 0 -rw-r--r-- 1 root root 0 Dec 12 09:21 f1.log [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# locate f1.log #我们发现locate命令竟然找不到f1.log文件,这是由于locate的数据库文件还没有来得及更新 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# updatedb #于是于是我们手动更新数据库信息,将之前修改的内容都同步到locate数据库中 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# locate f1.log # /root/f1.log [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
3>.省略选项搜索关键词案例
[root@node101.yinzhengjie.org.cn ~]# locate hosts /etc/hosts /etc/hosts.allow /etc/hosts.deny /etc/selinux/targeted/active/modules/100/denyhosts /etc/selinux/targeted/active/modules/100/denyhosts/cil /etc/selinux/targeted/active/modules/100/denyhosts/hll /etc/selinux/targeted/active/modules/100/denyhosts/lang_ext /usr/lib64/security/pam_rhosts.so /usr/share/ghostscript /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /usr/share/doc/pam-1.1.8/html/sag-pam_rhosts.html /usr/share/doc/pam-1.1.8/txts/README.pam_rhosts /usr/share/ghostscript/conf.d /usr/share/man/man5/hosts.allow.5.gz /usr/share/man/man5/hosts.deny.5.gz /usr/share/man/man5/hosts_access.5.gz /usr/share/man/man5/hosts_options.5.gz /usr/share/man/man8/pam_rhosts.8.gz /usr/share/vim/vim74/ftplugin/denyhosts.vim /usr/share/vim/vim74/ftplugin/hostsaccess.vim /usr/share/vim/vim74/syntax/denyhosts.vim /usr/share/vim/vim74/syntax/hostsaccess.vim /usr/share/zsh/site-functions/_sd_hosts_or_user_at_host /var/cache/yum/x86_64/7/timedhosts /var/cache/yum/x86_64/7/timedhosts.txt /var/www/html/phpMyAdmin/examples/config.manyhosts.inc.php [root@node101.yinzhengjie.org.cn ~]#
4>."-i"选项案例
[root@node101.yinzhengjie.org.cn ~]# locate HOSTS #我们搜索大写的关键词是搜不到有关HOSTS文件名称或路径的。 [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# locate -i HOSTS #我们使用"-i"选项可以忽略文件大小写,瞬间就可以匹配到包含hosts的文件名称或路径啦。 /etc/hosts /etc/hosts.allow /etc/hosts.deny /etc/selinux/targeted/active/modules/100/denyhosts /etc/selinux/targeted/active/modules/100/denyhosts/cil /etc/selinux/targeted/active/modules/100/denyhosts/hll /etc/selinux/targeted/active/modules/100/denyhosts/lang_ext /usr/lib64/security/pam_rhosts.so /usr/share/ghostscript /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /usr/share/doc/pam-1.1.8/html/sag-pam_rhosts.html /usr/share/doc/pam-1.1.8/txts/README.pam_rhosts /usr/share/ghostscript/conf.d /usr/share/man/man5/hosts.allow.5.gz /usr/share/man/man5/hosts.deny.5.gz /usr/share/man/man5/hosts_access.5.gz /usr/share/man/man5/hosts_options.5.gz /usr/share/man/man8/pam_rhosts.8.gz /usr/share/vim/vim74/ftplugin/denyhosts.vim /usr/share/vim/vim74/ftplugin/hostsaccess.vim /usr/share/vim/vim74/syntax/denyhosts.vim /usr/share/vim/vim74/syntax/hostsaccess.vim /usr/share/zsh/site-functions/_sd_hosts_or_user_at_host /var/cache/yum/x86_64/7/timedhosts /var/cache/yum/x86_64/7/timedhosts.txt /var/www/html/phpMyAdmin/examples/config.manyhosts.inc.php [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
5>."-n"选项案例
[root@node101.yinzhengjie.org.cn ~]# locate hosts /etc/hosts /etc/hosts.allow /etc/hosts.deny /etc/selinux/targeted/active/modules/100/denyhosts /etc/selinux/targeted/active/modules/100/denyhosts/cil /etc/selinux/targeted/active/modules/100/denyhosts/hll /etc/selinux/targeted/active/modules/100/denyhosts/lang_ext /usr/lib64/security/pam_rhosts.so /usr/share/ghostscript /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /usr/share/doc/pam-1.1.8/html/sag-pam_rhosts.html /usr/share/doc/pam-1.1.8/txts/README.pam_rhosts /usr/share/ghostscript/conf.d /usr/share/man/man5/hosts.allow.5.gz /usr/share/man/man5/hosts.deny.5.gz /usr/share/man/man5/hosts_access.5.gz /usr/share/man/man5/hosts_options.5.gz /usr/share/man/man8/pam_rhosts.8.gz /usr/share/vim/vim74/ftplugin/denyhosts.vim /usr/share/vim/vim74/ftplugin/hostsaccess.vim /usr/share/vim/vim74/syntax/denyhosts.vim /usr/share/vim/vim74/syntax/hostsaccess.vim /usr/share/zsh/site-functions/_sd_hosts_or_user_at_host /var/cache/yum/x86_64/7/timedhosts /var/cache/yum/x86_64/7/timedhosts.txt /var/www/html/phpMyAdmin/examples/config.manyhosts.inc.php [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]# locate -n 5 hosts #之列出前5个匹配到的文件名称或路径名称 /etc/hosts /etc/hosts.allow /etc/hosts.deny /etc/selinux/targeted/active/modules/100/denyhosts /etc/selinux/targeted/active/modules/100/denyhosts/cil [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
6>."-r"选项案例
[root@node101.yinzhengjie.org.cn ~]# locate -r "\\.conf$" /etc/GeoIP.conf /etc/asound.conf /etc/chrony.conf /etc/dracut.conf /etc/e2fsck.conf /etc/host.conf /etc/kdump.conf /etc/krb5.conf /etc/ld.so.conf /etc/libaudit.conf /etc/libuser.conf /etc/locale.conf /etc/logrotate.conf /etc/man_db.conf /etc/mke2fs.conf /etc/nsswitch.conf /etc/resolv.conf /etc/rsyncd.conf /etc/rsyslog.conf /etc/sestatus.conf /etc/sudo-ldap.conf /etc/sudo.conf /etc/sysctl.conf /etc/updatedb.conf /etc/vconsole.conf /etc/yum.conf /etc/NetworkManager/NetworkManager.conf /etc/X11/xorg.conf.d/00-keyboard.conf /etc/audisp/audispd.conf /etc/audisp/plugins.d/af_unix.conf /etc/audisp/plugins.d/syslog.conf /etc/audit/auditd.conf /etc/dbus-1/session.conf /etc/dbus-1/system.conf /etc/dbus-1/system.d/FirewallD.conf /etc/dbus-1/system.d/com.redhat.tuned.conf /etc/dbus-1/system.d/nm-dispatcher.conf /etc/dbus-1/system.d/nm-ifcfg-rh.conf /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf /etc/dbus-1/system.d/org.freedesktop.PolicyKit1.conf /etc/dbus-1/system.d/org.freedesktop.hostname1.conf /etc/dbus-1/system.d/org.freedesktop.import1.conf /etc/dbus-1/system.d/org.freedesktop.locale1.conf /etc/dbus-1/system.d/org.freedesktop.login1.conf /etc/dbus-1/system.d/org.freedesktop.machine1.conf /etc/dbus-1/system.d/org.freedesktop.systemd1.conf /etc/dbus-1/system.d/org.freedesktop.timedate1.conf /etc/dbus-1/system.d/teamd.conf /etc/dbus-1/system.d/wpa_supplicant.conf /etc/depmod.d/dist.conf /etc/firewalld/firewalld.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/userdir.conf /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.modules.d/00-base.conf /etc/httpd/conf.modules.d/00-dav.conf /etc/httpd/conf.modules.d/00-lua.conf /etc/httpd/conf.modules.d/00-mpm.conf /etc/httpd/conf.modules.d/00-proxy.conf /etc/httpd/conf.modules.d/00-systemd.conf /etc/httpd/conf.modules.d/01-cgi.conf /etc/httpd/conf.modules.d/10-php.conf /etc/ld.so.conf.d/kernel-3.10.0-957.el7.x86_64.conf /etc/ld.so.conf.d/mariadb-x86_64.conf /etc/lvm/lvm.conf /etc/lvm/lvmlocal.conf /etc/modprobe.d/dccp-blacklist.conf /etc/modprobe.d/firewalld-sysctls.conf /etc/modprobe.d/tuned.conf /etc/openldap/ldap.conf /etc/pki/ca-trust/ca-legacy.conf /etc/plymouth/plymouthd.conf /etc/prelink.conf.d/fipscheck.conf /etc/prelink.conf.d/grub2.conf /etc/prelink.conf.d/nss-softokn-prelink.conf /etc/rsyslog.d/listen.conf /etc/sasl2/smtpd.conf /etc/security/access.conf /etc/security/chroot.conf /etc/security/group.conf /etc/security/limits.conf /etc/security/namespace.conf /etc/security/pam_env.conf /etc/security/pwquality.conf /etc/security/sepermit.conf /etc/security/time.conf /etc/security/limits.d/20-nproc.conf /etc/selinux/semanage.conf /etc/selinux/targeted/setrans.conf /etc/sysctl.d/99-sysctl.conf /etc/systemd/bootchart.conf /etc/systemd/coredump.conf /etc/systemd/journald.conf /etc/systemd/logind.conf /etc/systemd/system.conf /etc/systemd/user.conf /etc/tuned/tuned-main.conf /etc/udev/udev.conf /etc/wpa_supplicant/wpa_supplicant.conf /etc/yum/version-groups.conf /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum/pluginconf.d/langpacks.conf /etc/yum/protected.d/systemd.conf /home/yinzhengjie/.pyenv/.pip/pip.conf /home/yinzhengjie/.pyenv/cache/Python-3.6.9/Doc/docutils.conf /home/yinzhengjie/.pyenv/cache/Python-3.6.9/Doc/tools/pydoctheme/theme.conf /usr/lib/NetworkManager/conf.d/10-slaves-order.conf /usr/lib/dracut/dracut.conf.d/01-dist.conf /usr/lib/dracut/dracut.conf.d/01-microcode.conf /usr/lib/dracut/dracut.conf.d/02-rescue.conf /usr/lib/dracut/dracut.conf.d/50-nss-softokn.conf /usr/lib/dracut/dracut.conf.d/76-phys-port-name.conf /usr/lib/dracut/modules.d/40network/dhclient.conf /usr/lib/dracut/modules.d/98syslog/rsyslog.conf /usr/lib/dracut/modules.d/98systemd/dracut-tmpfiles.conf /usr/lib/modprobe.d/dist-alsa.conf /usr/lib/modprobe.d/dist-blacklist.conf /usr/lib/sysctl.d/00-system.conf /usr/lib/sysctl.d/10-default-yama-scope.conf /usr/lib/sysctl.d/50-default.conf /usr/lib/tmpfiles.d/cryptsetup.conf /usr/lib/tmpfiles.d/etc.conf /usr/lib/tmpfiles.d/httpd.conf /usr/lib/tmpfiles.d/initscripts.conf /usr/lib/tmpfiles.d/legacy.conf /usr/lib/tmpfiles.d/libselinux.conf /usr/lib/tmpfiles.d/lvm2.conf /usr/lib/tmpfiles.d/mariadb.conf /usr/lib/tmpfiles.d/pam.conf /usr/lib/tmpfiles.d/python.conf /usr/lib/tmpfiles.d/rpm.conf /usr/lib/tmpfiles.d/sap.conf /usr/lib/tmpfiles.d/selinux-policy.conf /usr/lib/tmpfiles.d/sudo.conf /usr/lib/tmpfiles.d/systemd-nologin.conf /usr/lib/tmpfiles.d/systemd.conf /usr/lib/tmpfiles.d/tmp.conf /usr/lib/tmpfiles.d/tuned.conf /usr/lib/tmpfiles.d/var.conf /usr/lib/tmpfiles.d/x11.conf /usr/lib/tuned/balanced/tuned.conf /usr/lib/tuned/desktop/tuned.conf /usr/lib/tuned/latency-performance/tuned.conf /usr/lib/tuned/network-latency/tuned.conf /usr/lib/tuned/network-throughput/tuned.conf /usr/lib/tuned/powersave/tuned.conf /usr/lib/tuned/recommend.d/50-tuned.conf /usr/lib/tuned/throughput-performance/tuned.conf /usr/lib/tuned/virtual-guest/tuned.conf /usr/lib/tuned/virtual-host/tuned.conf /usr/share/alsa/alsa.conf /usr/share/alsa/cards/AACI.conf /usr/share/alsa/cards/ATIIXP-MODEM.conf /usr/share/alsa/cards/ATIIXP-SPDMA.conf /usr/share/alsa/cards/ATIIXP.conf /usr/share/alsa/cards/AU8810.conf /usr/share/alsa/cards/AU8820.conf /usr/share/alsa/cards/AU8830.conf /usr/share/alsa/cards/Audigy.conf /usr/share/alsa/cards/Audigy2.conf /usr/share/alsa/cards/Aureon51.conf /usr/share/alsa/cards/Aureon71.conf /usr/share/alsa/cards/CA0106.conf /usr/share/alsa/cards/CMI8338-SWIEC.conf /usr/share/alsa/cards/CMI8338.conf /usr/share/alsa/cards/CMI8738-MC6.conf /usr/share/alsa/cards/CMI8738-MC8.conf /usr/share/alsa/cards/CMI8788.conf /usr/share/alsa/cards/CS46xx.conf /usr/share/alsa/cards/EMU10K1.conf /usr/share/alsa/cards/EMU10K1X.conf /usr/share/alsa/cards/ENS1370.conf /usr/share/alsa/cards/ENS1371.conf /usr/share/alsa/cards/ES1968.conf /usr/share/alsa/cards/Echo_Echo3G.conf /usr/share/alsa/cards/FM801.conf /usr/share/alsa/cards/FWSpeakers.conf /usr/share/alsa/cards/FireWave.conf /usr/share/alsa/cards/GUS.conf /usr/share/alsa/cards/HDA-Intel.conf /usr/share/alsa/cards/HdmiLpeAudio.conf /usr/share/alsa/cards/ICE1712.conf /usr/share/alsa/cards/ICE1724.conf /usr/share/alsa/cards/ICH-MODEM.conf /usr/share/alsa/cards/ICH.conf /usr/share/alsa/cards/ICH4.conf /usr/share/alsa/cards/Loopback.conf /usr/share/alsa/cards/Maestro3.conf /usr/share/alsa/cards/NFORCE.conf /usr/share/alsa/cards/PC-Speaker.conf /usr/share/alsa/cards/PMac.conf /usr/share/alsa/cards/PMacToonie.conf /usr/share/alsa/cards/PS3.conf /usr/share/alsa/cards/RME9636.conf /usr/share/alsa/cards/RME9652.conf /usr/share/alsa/cards/SB-XFi.conf /usr/share/alsa/cards/SI7018.conf /usr/share/alsa/cards/TRID4DWAVENX.conf /usr/share/alsa/cards/USB-Audio.conf /usr/share/alsa/cards/VIA686A.conf /usr/share/alsa/cards/VIA8233.conf /usr/share/alsa/cards/VIA8233A.conf /usr/share/alsa/cards/VIA8237.conf /usr/share/alsa/cards/VX222.conf /usr/share/alsa/cards/VXPocket.conf /usr/share/alsa/cards/VXPocket440.conf /usr/share/alsa/cards/YMF744.conf /usr/share/alsa/cards/aliases.conf /usr/share/alsa/cards/pistachio-card.conf /usr/share/alsa/cards/vc4-hdmi.conf /usr/share/alsa/firmware/usx2yloader/us122.conf /usr/share/alsa/firmware/usx2yloader/us224.conf /usr/share/alsa/firmware/usx2yloader/us428.conf /usr/share/alsa/pcm/center_lfe.conf /usr/share/alsa/pcm/default.conf /usr/share/alsa/pcm/dmix.conf /usr/share/alsa/pcm/dpl.conf /usr/share/alsa/pcm/dsnoop.conf /usr/share/alsa/pcm/front.conf /usr/share/alsa/pcm/hdmi.conf /usr/share/alsa/pcm/iec958.conf /usr/share/alsa/pcm/modem.conf /usr/share/alsa/pcm/rear.conf /usr/share/alsa/pcm/side.conf /usr/share/alsa/pcm/surround21.conf /usr/share/alsa/pcm/surround40.conf /usr/share/alsa/pcm/surround41.conf /usr/share/alsa/pcm/surround50.conf /usr/share/alsa/pcm/surround51.conf /usr/share/alsa/pcm/surround71.conf /usr/share/alsa/topology/broadwell/broadwell.conf /usr/share/alsa/topology/bxtrt298/bxt_i2s.conf /usr/share/alsa/topology/sklrt286/skl_i2s.conf /usr/share/dbus-1/session.conf /usr/share/dbus-1/system.conf /usr/share/doc/NetworkManager/examples/server.conf /usr/share/doc/alsa-lib/modprobe-dist-oss.conf /usr/share/doc/dbus-1.10.24/examples/example-session-disable-stats.conf /usr/share/doc/dbus-1.10.24/examples/example-system-enable-stats.conf /usr/share/doc/glibc-common-2.17/gai.conf /usr/share/doc/gnupg2-2.0.22/examples/gpgconf.conf /usr/share/doc/httpd-2.4.6/httpd-dav.conf /usr/share/doc/httpd-2.4.6/httpd-default.conf /usr/share/doc/httpd-2.4.6/httpd-info.conf /usr/share/doc/httpd-2.4.6/httpd-languages.conf /usr/share/doc/httpd-2.4.6/httpd-manual.conf /usr/share/doc/httpd-2.4.6/httpd-mpm.conf /usr/share/doc/httpd-2.4.6/httpd-multilang-errordoc.conf /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /usr/share/doc/httpd-2.4.6/proxy-html.conf /usr/share/doc/krb5-libs-1.15.1/examples/kdc.conf /usr/share/doc/krb5-libs-1.15.1/examples/krb5.conf /usr/share/doc/python-configobj-4.7.2/docutils.conf /usr/share/doc/python-slip-0.4.0/dbus/example/org.fedoraproject.slip.example.mechanism.conf /usr/share/doc/python-slip-dbus-0.4.0/example/org.fedoraproject.slip.example.mechanism.conf /usr/share/doc/sudo-1.8.23/examples/pam.conf /usr/share/doc/sudo-1.8.23/examples/sudo.conf /usr/share/doc/sudo-1.8.23/examples/syslog.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_arp_ping_1.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_arp_ping_2.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_ethtool_1.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_ethtool_2.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_ethtool_3.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_multi_lw_1.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_nsna_ping_1.conf /usr/share/doc/teamd-1.27/example_configs/activebackup_tipc.conf /usr/share/doc/teamd-1.27/example_configs/broadcast.conf /usr/share/doc/teamd-1.27/example_configs/lacp_1.conf /usr/share/doc/teamd-1.27/example_configs/loadbalance_1.conf /usr/share/doc/teamd-1.27/example_configs/loadbalance_2.conf /usr/share/doc/teamd-1.27/example_configs/loadbalance_3.conf /usr/share/doc/teamd-1.27/example_configs/random.conf /usr/share/doc/teamd-1.27/example_configs/roundrobin.conf /usr/share/doc/teamd-1.27/example_configs/roundrobin_2.conf /usr/share/doc/wpa_supplicant-2.6/wpa_supplicant.conf /usr/share/doc/wpa_supplicant-2.6/examples/ieee8021x.conf /usr/share/doc/wpa_supplicant-2.6/examples/openCryptoki.conf /usr/share/doc/wpa_supplicant-2.6/examples/plaintext.conf /usr/share/doc/wpa_supplicant-2.6/examples/udhcpd-p2p.conf /usr/share/doc/wpa_supplicant-2.6/examples/wep.conf /usr/share/doc/wpa_supplicant-2.6/examples/wpa-psk-tkip.conf /usr/share/doc/wpa_supplicant-2.6/examples/wpa2-eap-ccmp.conf /usr/src/kernels/3.10.0-957.el7.x86_64/include/config/auto.conf /usr/src/kernels/3.10.0-957.el7.x86_64/include/config/tristate.conf /var/lib/NetworkManager/NetworkManager-intern.conf [root@node101.yinzhengjie.org.cn ~]#
7>.查看locate命令的帮助信息
[root@node101.yinzhengjie.org.cn ~]# locate --help Usage: locate [OPTION]... [PATTERN]... Search for entries in a mlocate database. -A, --all only print entries that match all patterns -b, --basename match only the base name of path names -c, --count only print number of found entries -d, --database DBPATH use DBPATH instead of default database (which is /var/lib/mlocate/mlocate.db) -e, --existing only print entries for currently existing files -L, --follow follow trailing symbolic links when checking file existence (default) -h, --help print this help -i, --ignore-case ignore case distinctions when matching patterns -l, --limit, -n LIMIT limit output (or counting) to LIMIT entries -m, --mmap ignored, for backward compatibility -P, --nofollow, -H don\'t follow trailing symbolic links when checking file existence -0, --null separate entries with NUL on output -S, --statistics don\'t search for entries, print statistics about each used database -q, --quiet report no error messages about reading databases -r, --regexp REGEXP search for basic regexp REGEXP instead of patterns --regex patterns are extended regexps -s, --stdio ignored, for backward compatibility -V, --version print version information -w, --wholename match whole path name (default) Report bugs to mitr@redhat.com. [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#
二.实时查找find工具
实时查找工具,通过遍历指定路径完成文件查找 工作特点: (1)查找速度略慢 (2)精确查找 (3)实时查找 (4)可能只搜索用户具备读取和执行权限的目录 语法: find [OPTION]... [查找路径] [查找条件] [处理动作] 查找路径:
指定具体目标路径;默认为当前目录 查找条件:
指定的查找标准,可以文件名、大小、类型、权限等标准进行; 默认为找出指定路径下的所有文件 处理动作:
对符合条件的文件做操作,默认输出至屏幕
1>.查看find命令的帮助信息
[root@node101.yinzhengjie.org.cn ~]# find --help Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] default path is the current directory; default expression is -print expression may consist of: operators, options, tests, and actions: operators (decreasing precedence; -and is implicit where no others are given): ( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2 EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2 positional options (always true): -daystart -follow -regextype normal options (always true, specified before other expressions): -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N -cnewer FILE -ctime N -empty -每天一个Linux命令(22)--find命令详解