为什么“查找”不返回所有现有文件?

问题描述

我想知道为什么locate不会在系统上更新所有.exe文件,因为它们是最新的:

ebra@him:~$ sudo updatedb
ebra@him:~$ locate *.exe
/home/ebra/a.exe
/home/ebra/Downloads/santa.exe
ebra@him:~$ 
ebra@him:~$ ls /usr/share/nmap/nselib/data/psexec/nmap_service.exe
/usr/share/nmap/nselib/data/psexec/nmap_service.exe
ebra@him:~$ 

updatedb.conf:

ebra@him:~$ which updatedb
/usr/bin/updatedb
ebra@him:~$ which locate
/usr/bin/locate
ebra@him:~$ type /usr/bin/updatedb
/usr/bin/updatedb is /usr/bin/updatedb
ebra@him:~$ type /usr/bin/locate
/usr/bin/locate is /usr/bin/locate
ebra@him:~$ 
ebra@him:~$ cat /etc/updatedb.conf 
PRUNE_BIND_MOUNTS="yes"
# PRUNENAMES=".git .bzr .hg .svn"
PRUNEPATHS="/tmp /var/spool /media /var/lib/os-prober /var/lib/ceph /home/.ecryptfs /var/lib/schroot"
PRUNEFS="NFS afs autofs binfmt_misc ceph cgroup cgroup2 cifs coda configfs curlftpfs debugfs devfs devpts devtmpfs ecryptfs ftpfs fuse.ceph fuse.cryfs fuse.encfs fuse.glusterfs fuse.gvfsd-fuse fuse.mfs fuse.rozofs fuse.sshfs fusectl fusesmb hugetlbfs iso9660 lustre lustre_lite mfs mqueue ncpfs nfs nfs4 ocfs ocfs2 proc pstore rpc_pipefs securityfs shfs smbfs sysfs tmpfs tracefs udev udf usbfs"
ebra@him:~$ 

解决方法

由于当前(主)目录中有一个名为a.exe的文件,因此外壳程序正在扩展*.exe,因此您可以有效地运行命令

$ locate a.exe

尝试不带星号或带转义的星号

$ locate \*.exe