在Ubuntu中,可按以下方法快速查找文件:
locate
命令:安装mlocate
后(sudo apt-get install mlocate
),通过sudo updatedb
更新数据库,再使用locate [选项] [模式]
查找文件,如locate example.txt
,支持通配符(*
、?
)和正则表达式(-r
选项),查找速度快,但结果实时性较差。find
命令:在终端输入find [路径] [选项] [表达式]
,如find / -name "filename"
,可按名称、类型、大小、时间等条件精确查找,但速度较慢,适合复杂条件搜索。