Linux文件搜索之 find / locate / whereis / which
来源:互联网 发布:hifi软件下载 编辑:程序博客网 时间:2024/06/05 08:35
find最强大,什么都能查
which只能查可执行文件
whereis只能查二进制文件、说明文档,源文件等
locate能查所以,但跟whereis一样都是查数据库里的内容。
locate 是在数据库里查找,数据库大至每天更新一次。
whereis 可以找到可执行明令和man page
find 就是根据条件查找文件。
which 可以找到可执行文件和别名(alias)
Linux文件搜索之 find / locate / whereis / which
1.find /etc -name my.so
2.locate 是用来通过文件名搜索文件的工具,它的用法也比较简单。locate 的应用,首先要通过updatedb建立索引数据库,然后才能应用;如果您新安装了软件或者存放了新的文件,也要先运行updatedb命令,以生成最新索引库。
用法:locate 文件名
我们要先运行updatedb;
[root@localhost ~]# updatedb
举例: 我们要找vsftpd.conf文件都位于哪个位置;
[root@localhost ~]# locate my.so
3.whereis 是来寻找命令的二进制文件,同时也会找到其帮助文件;
比如我们不知道fdisk工具放在哪里,我们就可以用whereis fdisk 来查找;
[root@localhost ~]# whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
如果我们寻找grub在哪里,应该用如下命令,说明grub位于/sbin目录,他的帮助文件是grub.8.gz ,也就是man grub;
[root@localhost ~]# whereis grub
grub: /sbin/grub /etc/grub.conf /usr/share/grub /usr/share/man/man8/grub.8.gz
4.which 和where 相似,只是我们所设置的环境变量中设置好的路径中寻找;比如;
[root@localhost ~]# which fdisk
/sbin/fdisk
find是从指定目录开始分级查找,缺点是速度慢,但是查的文件是当前存在在硬盘上的文件
locate是从生成的数据库开始查照,速度很快,因为只需要查找数据库,但是功能上有很多限制,而且跟数据库的新旧有关,默认是系统启动的时候,cron.daily来执行数据库更新的任务(有个updatedb).
至于whereis,我不是很清楚,不过感觉他只是查照可执行文件和相关的man,这个我说得不一定对,大家可以更正一下
- Linux文件搜索之 find / locate / whereis / which
- Linux文件搜索之 find / locate / whereis / which
- Linux文件搜索之 find / locate / whereis / which
- Linux下搜索文件find、which、whereis、locate
- Linux 文件搜索指令 find locate whereis which type
- linux命令:文件搜索(locate、whereis、which、find、grep)
- 文件搜索命令 locate、find、whereis、which
- linux which whereis locate find
- 五、Linux常用命令之文件搜索篇(which、whereis、find、locate、grep、man、info、whatis、--help、apropos、help)
- Linxu命令与文件的搜索 - which, whereis, locate, find
- Linux 搜索命令(locate/find/whereis/which/grep)
- linux中文件搜索命令(whereis,locate,which,find)
- Linux 搜索命令:find,locate,whereis,which,type
- Linux常用命令002之搜索命令locate、whereis、which、find、grep
- Linux常用命令002之搜索命令locate、whereis、which、find、grep
- linux中Find、whereis、locate、which查找文件命令总结
- linux中Find、whereis、locate、which查找文件命令总结
- linux中Find、whereis、locate、which查找文件命令详解
- 如何查看oracle数据库的某个表上已经建立了那些索引
- redhat系统mysql数据库的安装
- HttpServer的一些经验
- 2008年7月23日,晴天,学习这件事,不是缺乏时间,而是缺乏努力。——哈佛自习墙
- 生成随机数
- Linux文件搜索之 find / locate / whereis / which
- WCF 关于自定义MessageHeader支持
- symbian对话框总结-标准对话框
- 柳传志的94-97年,从创业者到商界领袖
- getOutputStream() has already been called for this response问题的解决
- 针对 WCF 数据压缩开发包压缩效率的测试比较
- build.xml 配置文档模板:
- ASP.NET WEB 开发效率 应注意的几个方面
- WF 工作流实例持久化几点说明