linux命令——find

    在linux中,如果我们的文件数量过多,对于慢慢寻找是不现实的,因此我们需要使用搜索工具进行搜索,这里介绍一个搜索命令:find

基本使用语法:

find 目录 -name 关键字 -print

    这个命令的意思是在一个目录中查看有该关键字(可以是目录,可以是文件名)的文件,并输出到屏幕中!

root@VM-12-155-debian:~# find / -name test -print
/usr/src/linux-headers-4.9.0-kali3-amd64/include/config/usb/ehset/test
/usr/src/linux-headers-4.9.0-kali3-amd64/include/config/test
/usr/src/linux-headers-4.9.0-kali3-amd64/include/config/v4l/test


    另外我们可以使用-type来指定查找的内容

root@VM-12-155-debian:~# find /var/www/ -name index.html -type f -print
/var/www/html/jaxsec/index.html
/var/www/html/index.html
root@VM-12-155-debian:~# find /var/www/ -name www -type d -print
/var/www/
root@VM-12-155-debian:~#
b——块设备文件,f——普通文件,d——目录文件,l——符号链接文件


    这个命令查找文件相对还是有点慢,下一个命令将介绍locate这个命令,也是查找文件的,但是更快速!