1.find /etc -name my.so
2.locate 是用來通過文件名搜索文件的工具,它的用法也比較簡單。locate 的應(yīng)用,首先要通過updatedb建立索引數(shù)據(jù)庫,然后才能應(yīng)用;如果您新安裝了軟件或者存放了新的文件,也要先運(yùn)行updatedb命令,以生成最新索引庫。
用法:locate 文件名
我們要先運(yùn)行updatedb;
- [root@localhost ~]# updatedb
[root@localhost ~]# updatedb
舉例: 我們要找vsftpd.conf文件都位于哪個(gè)位置;
- [root@localhost ~]# locate my.so
[root@localhost ~]# locate my.so
3.whereis 是來尋找命令的二進(jìn)制文件,同時(shí)也會找到其幫助文件;
比如我們不知道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在哪里,應(yīng)該用如下命令,說明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 相似,只是我們所設(shè)置的環(huán)境變量中設(shè)置好的路徑中尋找;比如;
- [root@localhost ~]# which fdisk
- /sbin/fdisk