find、locate、whereis、which和type
1. find
$ find . -name '*'
2. locate
很快速的搜寻档案系统内是否有指定的档案,比find要快很多
其方法是先建立一个包括系统内所有档案名称及路径的资料库,之后当寻找时就只需查询这个资料库(/var/lib/locatedb),而不必实际深入档案系统之中了
# locate /root/hbu8.0/bin/h
搜索/root/hbu8.0/bin/目录下(绝对路径),所有以h开头的文件
如果报错:
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
解决办法:
# updatedb
选项:
-o<文件>:忽略默认的数据库文件,使用指定的slocate数据库文件
-U<目录>:更新指定目录的slocate数据库
-v:显示执行的详细过程
updatedb 命令不会自动更新新挂载的磁盘,需要-U指定一下新挂载的磁盘
3. whereis
找到指定文件的源、二进制文件和手册等各部分
# whereis -b hbu-fd
- -b 搜索文件的二进制部分
- -m 搜索文件的手册部分
- -s 搜索文件的源部分
- -u 没有说明文档的文件
4. which
在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。也就是说,搜索系统命令执行的到底是哪一个位置的命令
# which sh
5. type
用来区分某个命令到底是由shell自带的,还是由shell外部的独立二进制文件提供的
# type cd
使用-p参数,相当于which命令
# type -p cd
find、locate、whereis、which和type的更多相关文章
- Linux的五个查找命令:find,locate,whereis,which,type
使用电脑的时候,经常需要查找文件. 在Linux中,有很多方法可以做到这一点.国外网站LinuxHaxor总结了五条命令,你可以看看自己知道几条.大多数程序员,可能经常使用其中的2到3条,对这5条命令 ...
- Linux的五个查找命令find,locate,whereis,which,type
Linux的五个查找命令 1. find 最常见且最强大的命令,可以查找任何文件. 格式 $ find 指定目录 指定条件 指定动作 指定目录: 所要搜索的目录及其子目录,默认当前目录 ...
- linux 命令中的find locate whereis which type 使用区别
find 最强大,但参数也较多,需指定查找目录,如 find / -name “filename” locate 是一个快速查找命令,有预先索引好的数据库,由于数据库是定时更新,因此,结果上可能会有迟 ...
- 【转】Linux的五个查找命令:find,locate,whereis,which,type
原文网址:http://www.ruanyifeng.com/blog/2009/10/5_ways_to_search_for_files_using_the_terminal.html 最近,我在 ...
- Linux的五个查找命令:find,locate,whereis,which,type 及其区别
1. find find是最常见和最强大的查找命令,你可以用它找到任何你想找的文件. find的使用格式如下: $ find <指定目录> <指定条件> <指定动作> ...
- 四个查找命令find,locate,whereis,which的区别
find最强大,但是检索硬盘,比较慢: whereis只能查二进制文件.说明文档,源文件等: locate能查所有文件,但跟whereis一样都是查数据库里的内容,速度快,但有延时: which 只能 ...
- Liunx find/locate/whereis/which 总结
一.locate 命令 是一个文件查找命令,命令所属软件包 mlocate 不同于 find 命令的是,find命令在整块磁盘中搜索:而 locate命令 在数据路库文件中搜索,当天创建的文件第二天才 ...
- 命令与文件的查询 which whereis locate find
一:which which查找脚本文件也就是我们的系统命令 用法:which [command] 默认根据我们PATH路径去查找,但是不同的用户肯定设置不同的PATH,所以就像普通用户查找不到一些/s ...
- linux命令中find, which、whereis、locate,有什么区别?
whatis 用于查询一个命令执行什么功能,并将查询结果打印到终端上 which 查看可执行文件的位置 whereis 查看文件的位置 man Linux提供了丰富的帮助手册,当你需要查看某个命令的参 ...
- linux type 命令和Linux的五个查找命令
type命令用来显示指定命令的类型.一个命令的类型可以是如下之一 alias 别名 keyword 关键字,Shell保留字 function 函数,Shell函数 builtin 内建命令,Shel ...
随机推荐
- 201871010112-梁丽珍《面向对象程序设计(java)》第八周学习总结
项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p ...
- Nacos 知识点
Nacos 名字的由来(取红色的英文字符): Dynamic Naming and Configuration Service Nacos 是 Spring Cloud Alibaba 的一个组件,详 ...
- 【Spring AOP】AOP介绍(一)
AOP(Aspect Oriented Programming) 面向切面编程,是Spring框架的一个重要组件. AOP应该算是对OOP(面向对象编程)的补充和完善.OOP引入封装.继承.多态等概念 ...
- IP、MAC和端口号(六)
在茫茫的互联网海洋中,要找到一台计算机非常不容易,有三个要素必须具备,它们分别是 IP 地址.MAC 地址和端口号. 一.IP地址 IP地址是 Internet Protocol Address 的缩 ...
- 洛谷 SP9722 CODESPTB - Insertion Sort
洛谷 SP9722 CODESPTB - Insertion Sort 洛谷传送门 题目描述 Insertion Sort is a classical sorting technique. One ...
- springboot模板(Freemarker与Thymeleaf)
Thymeleaf模板 Thymeleaf就是html页面 导入pom依赖 <dependency> <groupId>org.springframework.boot< ...
- [LeetCode] 13. Roman to Integer 罗马数字转化成整数
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 ...
- 【CF1097F】Alex and a TV Show
[CF1097F]Alex and a TV Show 题面 洛谷 题解 我们对于某个集合中的每个\(i\),令\(f(i)\)表示\(i\)作为约数出现次数的奇偶性. 因为只要因为奇偶性只有\(0, ...
- [LeetCode] 486. Predict the Winner 预测赢家
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from eith ...
- [LeetCode] 137. Single Number II 单独的数字之二
Given a non-empty array of integers, every element appears three times except for one, which appears ...