我使用哪个命令从特定目录查找特定文件?
答
使用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
或者只是'找到-ls'。 – tripleee 2014-10-29 18:34:54
@tripleee我觉得很愚蠢,我甚至都不知道'find -ls'。谢谢。 – ptierno 2014-10-29 18:38:52