哪个命令允许从主目录开始查找特定文件(例如:test.doc)?
我首先需要'su username',然后是ls-> cd或者是否有特定的命令执行此操作?
答案 0 :(得分:1)
使用find
命令:
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