🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
查找文件 ======== 比如知道文件名字为`httpd.conf`, 可以这样查找 ```shell find / -name httpd.conf locate httpd.conf ``` 或者只知道一部分, 这样 ```shell find / -name httpd* locate httpd ``` find的命令结构为 ```shell find [path...][expression] ``` 更多的通过 ```shell man find ``` `locate`和`find -name`很像, 这里说一下他们的不同 假如搜索css, find -name只会搜索名称, 而locate 会包含路径上都含有css的 locate是搜索索引数据库, 所以速度比find快, 但是可能不是最新的, `updatedb`更新索引数据库 locate可以接-i忽略大小写 find其实功能还有很多, 只是我常用的只用到这些, 他的expression除了name还有很多的 级联搜索 ```shell locate httpd | grep httpd.conf ``` 还有一个命令也可以搜索- `whereis`,但是只能查找可执行文件 ``` [root@iZuf6hw ~]# whereis httpd httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz ```