Linux 我应该使用哪个命令来查找从特定目录开始的特定文件?

Linux 我应该使用哪个命令来查找从特定目录开始的特定文件?,linux,shell,unix,command-line,command,Linux,Shell,Unix,Command Line,Command,哪个命令允许从主目录查找特定文件(例如:test.doc) 我需要先输入“su username”,然后输入ls->cd,还是有特定的命令执行此操作?使用查找命令: find /home/foo -name 'test.doc' 或对于不区分大小写的搜索: find /home/foo -iname 'test.doc' 这将输出文件名,包括相对路径。如果您需要一些更详细的信息,例如ls-l test.doc的输出,您可以执行以下操作: find /home/foo -iname 't

哪个命令允许从主目录查找特定文件(例如:test.doc)


我需要先输入“su username”,然后输入ls->cd,还是有特定的命令执行此操作?

使用
查找
命令:

 find /home/foo -name 'test.doc'
或对于不区分大小写的搜索:

 find /home/foo -iname 'test.doc'
这将输出文件名,包括相对路径。如果您需要一些更详细的信息,例如
ls-l test.doc的输出,您可以执行以下操作:

 find /home/foo -iname 'test.doc' -exec ls -lh {} \;
或者直接将其输送到
xargs

 find /home/foo -iname 'test.doc' | xargs ls -lh

@tripleee我觉得很傻,我甚至不知道
find-ls
。非常感谢。