我正在尝试settings.xml在我的 Ubuntu 机器中查找文件。我不知道它在哪里,以及它在哪个目录中。
我试过用这个 -
ls -R | grep settings.xml
Run Code Online (Sandbox Code Playgroud)
但它没有向我显示它所在的完整路径.. 有没有我需要尝试的其他命令可以给我完整路径?
use*_*.dz 25
对于快速搜索(但不是确定的):
locate -br '^settings.xml$'
Run Code Online (Sandbox Code Playgroud)
来自man locate:
locate reads one or more databases prepared by updatedb(8) and writes
file names matching at least one of the PATTERNs to standard output,
one per line.
-b, --basename
Match only the base name against the specified patterns. This
is the opposite of --wholename.
-r, --regexp REGEXP
Search for a basic regexp REGEXP. No PATTERNs are allowed if
this option is used, but this option can be specified multiple
times.
Run Code Online (Sandbox Code Playgroud)
在^和$确保只有文件名为settings.xml而不是文件名称中包含 settings.xml将被打印出来。
您可能需要第一次运行:(updatedb作为root)来更新/构建locate.
X T*_*ian 17
通过文件系统缓慢但稳定地搜索,但最终确定。
find / -xdev -name settings.xml
Run Code Online (Sandbox Code Playgroud)
这将需要一些时间,您可能会收到一些权限错误,但它会到达那里。如果您对它可能位于的位置有更多想法,请将第一个目录从 更改/为/where/you/guess