2024年11月Linux如何使用locate命令查找数据(2)

发布时间:

  ⑴实例:查找和pwd相关的所有文件

  ⑵locate pwd

  ⑶peida-VirtualBox ~ # locate pwd

  ⑷/bin/pwd

  ⑸/etc/.pwd.lock

  ⑹/sbin/unix_chkpwd

  ⑺/usr/bin/pwdx

  ⑻/usr/include/pwd.h

  ⑼/usr/lib/python./dist-packages/twisted/python/fakepwd.py

  ⑽/usr/lib/python./dist-packages/twisted/python/fakepwd.pyc

  ⑾/usr/lib/python./dist-packages/twisted/python/test/test_fakepwd.py

  ⑿/usr/lib/python./dist-packages/twisted/python/test/test_fakepwd.pyc

  ⒀/usr/lib/syslinux/pwd.c

  ⒁/usr/share/help/C/empathy/irc-join-pwd.page

  ⒂/usr/share/help/ca/empathy/irc-join-pwd.page

  ⒃/usr/share/help/cs/empathy/irc-join-pwd.page

  ⒄/usr/share/help/de/empathy/irc-join-pwd.page

  ⒅/usr/share/help/el/empathy/irc-join-pwd.page

  ⒆实例: 搜索etc目录下所有以sh开头的文件

  ⒇locate /etc/sh

  ⒈peida-VirtualBox ~ # locate /etc/sh

  ⒉/etc/shadow

  ⒊/etc/shadow-

  ⒋/etc/shells

  ⒌peida-VirtualBox ~ #

  ⒍实例:搜索etc目录下,所有以m开头的文件

  ⒎locate /etc/m

  ⒏peida-VirtualBox ~ # locate /etc/m

  ⒐/etc/magic

  ⒑/etc/magic.mime

  ⒒/etc/mailcap

  ⒓/etc/mailcap.order

  ⒔/etc/manpath.config

  ⒕/etc/mate-settings-daemon

  ⒖上面就是Linux locate命令的用法介绍了,使用该命令可以查找指定文件,在locate命令无法查找资源的情况下还可使用find命令和whereis命令等命令查找文件(详见Linux的查找文件命令是什么?。