Linux文件搜索之 find / locate / whereis / which
2008-07-23 20:27
519 查看
find最强大,什么都能查
which只能查可执行文件
whereis只能查二进制文件、说明文档,源文件等
locate能查所以,但跟whereis一样都是查数据库里的内容。
locate 是在数据库里查找,数据库大至每天更新一次。
whereis 可以找到可执行明令和man page
find 就是根据条件查找文件。
which 可以找到可执行文件和别名(alias)
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,这个我说得不一定对,大家可以更正一下
which只能查可执行文件
whereis只能查二进制文件、说明文档,源文件等
locate能查所以,但跟whereis一样都是查数据库里的内容。
locate 是在数据库里查找,数据库大至每天更新一次。
whereis 可以找到可执行明令和man page
find 就是根据条件查找文件。
which 可以找到可执行文件和别名(alias)
Linux文件搜索之 find / locate / whereis / which
1.find /etc -name my.so2.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文件查找命令具体解释-which whereis find locate
- Linux文件查找命令详解-which whereis find locate
- Linux 搜索命令(locate/find/whereis/which/grep)
- Linux下相关查找文件命令(find locate which whereis type)
- 如何查找Linux文件 存放在哪(地点) locate find whereis which 命令
- Linux下文件查找指令which/whereis/locate/find
- 如何查找Linux文件 存放在哪(地点) locate find whereis which 命令
- 如何查找Linux文件 存放在哪(地点) locate find whereis which 命令
- Linux下文件查找指令(which/whereis/locate/find
- *Linux常用命令学习2---(文件搜索命令locate find、命令搜索命令whereis which、字符串搜索命令grep、帮助命令man)
- Linux 指令与文件的搜寻 —— which whereis locate updatedb find
- linux下的文件查找——type whereis which find locate
- [Linux学习]文件搜索whereis & locate & find
- 如何查找Linux文件 存放在哪(地点) locate find whereis which 命令
- Linux学习总结(十五)文件查找 which whereis locate find
- Linux 查找命令 which whereis locate find
- linux下面which whereis find locate的使用
- linux 命令 which whereis find locate
- 文件查找 /which/whereis/locate/find/grep