码迷,mamicode.com
首页 > 系统相关 > 详细

linux命令——find

时间:2017-08-15 23:06:25      阅读:319      评论:0      收藏:0      [点我收藏+]

标签: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这个命令,也是查找文件的,但是更快速!


本文出自 “eth10” 博客,请务必保留此出处http://eth10.blog.51cto.com/13143704/1956442

linux命令——find

标签:linux命令   find   

原文地址:http://eth10.blog.51cto.com/13143704/1956442

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!