plocate查找系统上与给定模式匹配的所有文件。基于locate,在更小的索引上提供更快的搜索。
当您需要在 Linux 中搜索某些文件时,您通常可能会使用find或locate命令。不过,现在您有了一个名为plocate的命令。
plocate 通过在搜索字符串中的三元组(三个字节的组合)上创建倒排索引来工作,这允许它快速将候选集缩小到一个非常小的列表,而不是线性扫描每个条目。
该工具已经得到快速发展。例如,Fedora 36 计划将 plocate 其locate 用作在文件系统上查找文件的命令的新提供者 。
安装
Debian 11 Bullseye 及更新版本、Debian 10 Buster 向后移植、Ubuntu 21.04、21.10 及更新版本:
linuxmi@linuxmi:~/www.linuxmi.com$ sudo apt install plocate
Arch Linux 及其衍生产品:
linuxmi@linuxmi:~/www.linuxmi.com$ sudo pacman -S plocate
Fedora:
linuxmi@linuxmi:~/www.linuxmi.com$ plocate linuxmi.com.py
如果您找不到某些文件,则可能有两个罪魁祸首:
1. 首先,检查数据库最近是否有更新。大多数用户会想要使用 plocate 的updatedb.
有一个服务和一个定时器来定期更新数据库。您可以启用它,它会自动触发服务:
linuxmi@linuxmi:~/www.linuxmi.com$ sudo systemctl enable plocate-updatedb.timer
linuxmi@linuxmi:~/www.linuxmi.com$ sudo systemctl start plocate-updatedb.timer
2. 文件未显示的另一个原因通常是权限。检查您是否可以以 root 身份找到这些文件,如果可以,问题很可能是您没有从根目录开始一直访问该目录的权限。
不要 locate 命令,Linux plocate 才是更好的抉择
plocate查找系统上与给定模式匹配的所有文件。基于locate,在更小的索引上提供更快的搜索。 当您需要在 Linux 中搜索某些文件时,您通常可能会使用find或locate命令。不过,现在您有了一个名为plocate的命令。 plocate 通过在搜索字符串中的三元组(三个字
本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/server/linux/2021/1223/42327.html