linux下查找文件命令:locate 和 find
来源:互联网 发布:葫芦丝软件免费下载 编辑:程序博客网 时间:2024/06/13 03:00
如下内容来自:http://hi.baidu.com/hunnon/blog/item/20f6a627e2b4481d8a82a1d7.html
对于初次切换到 Linux 系统的朋友来说,如果想要从命令行界面执行查找文件的任务的话,那么,locate 和 find 是两个需要了解的命令。虽说这两个命令都可以满足查找文件的操作,不过却是各有所长,在选择上不妨兼而用之。
- locate:该命令在运行时需要后台索引的数据库作为支撑,在 Ubuntu 中这个数据库文件位于 /var/cache/locate/locatedb。一般来说,这个数据库文件每天是通过 cron 自动更新的。如果不幸没有得到更新,那么可以执行
sudo updatedb
来手动更新。 假如我想要在系统中查找一个名为 linux.html 的文件,那么可以这样执行命令:locate linux.html
。locate 搜索文件的速度很快,一会儿就会把结果列出来。locate 有一个十分有用的选项 -r,它可以让你在搜索文件时使用正则表达式。 - find:这是另一个 Linux 系统中重要的文件查找命令。find 命令的功能很强大,其一般使用方法为:
find 位置 -name 文件名称
。例如,我要在 / 这个根目录中查找 linux.html 文件,可以执行find / -name linux.html
。你除了可以按文件名称来使用 find 查找文件外,也可以根据文件大小(通过 -size n 选项指定)、时间(如 -atime n 表示查找 n 天前访问过的文件)来搜索文件。 此外,find 命令同样支持在搜索文件时使用正则表达式,你只需指定 -regex 选项即可。
值得注意的是,对于 locate 与 find 这两个命令的解说远非这篇小文所能满足。关于这两个命令的更加详细的用法,你可能需要通过 man locate 或 man find 查询。
- linux下查找文件命令:locate 和 find
- Linux下查找文件的命令:locate 和 find
- linux文件查找命令locate和find
- Linux下which、whereis、locate、find 命令查找文件
- Linux下which、whereis、locate、find 命令查找文件
- Linux下which、whereis、locate、find 命令查找文件
- Linux下which、whereis、locate、find 命令查找文件
- linux 下查找文件或者内容命令whereis,locate ,find
- linux下常用查找命令locate find
- Linux下locate命令和find命令
- Linux下locate命令和find命令
- Linux下locate命令和find命令
- Linux下locate命令和find命令
- linux下查找文件命令总结find、locate、whereis、which、type
- linux下的文件查找命令总结:find、locate、whereis、which
- linux中Find、whereis、locate、which查找文件命令总结
- linux中Find、whereis、locate、which查找文件命令总结
- linux中Find、whereis、locate、which查找文件命令详解
- php生成xml
- java学习之编译时类型和运行时类型
- 用户空间使用Linux 数据结构系列导读篇
- 通过对URL判断,检测引用的文件是否存在
- 【解决问题】Gallery中外框和内框冲突的问题
- linux下查找文件命令:locate 和 find
- column not allowed here
- c#判断类名规范
- Struts2 文件下载
- 简单的如何在eclipse打包JAR
- 【组合数+高精度】爱与希望(hope)
- Java泛型
- 调整Ubuntu Unity 快捷启动栏的大小
- python里的装饰器