1.find /etc -name my.so
2.locate 是用来通过文件名搜索文件的工具,它的用法也比较简单。locate 的应用,首先要通过updatedb建立索引数据库,然后才能应用;如果您新安装了软件或者存放了新的文件,也要先运行updatedb命令,以生成最新索引库。
用法:locate 文件名
我们要先运行updatedb;
- [root@localhost ~]# updatedb
[root@localhost ~]# updatedb
举例: 我们要找vsftpd.conf文件都位于哪个位置;
- [root@localhost ~]# locate my.so
[root@localhost ~]# locate my.so
3.whereis 是来寻找命令的二进制文件,同时也会找到其帮助文件;
比如我们不知道fdisk工具放在哪里,我们就可以用whereis fdisk 来查找;
- [root@localhost ~]# whereis fdisk
- fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
[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
[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