linux 下find、locate、whereis、which以及type命令使用

来源:互联网 发布:数控铣床编程创意图案 编辑:程序博客网 时间:2024/06/05 08:08

find、locate、whereis、which四个命令都是linux下的查找命令,但是作用和使用方式各有不同,分别如下:

1.find

用法 find <directory> <condition> <action>

例如: find /opt -name "*.log" -exec rm -rf {}

2.locate

locate 相当于find -name,只不过是利用了一个数据库中的内容来快速定位,该数据库每天更新一次。也可以用updatedb来更新

例如:locate ./m 查找当前目录下m开头的文件

3.whereis

用于搜索程序名,包括二进制文件,man文件源代码文件

4.which

在path变量指定的路径中,搜索系统命令路径

5.type

用于区分某个命令是shell自带的还是外部的

0 0