ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux文件搜索之 find / locate / whereis / which

Linux文件搜索之 find / locate / whereis / which

原创 Linux操作系统 作者:梧桐雨—168 时间:2008-03-19 15:22:20 0 删除 编辑

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

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13270562/viewspace-211678/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-28

  • 博文量
    141
  • 访问量
    429032