linux locate
locate命令查找文件比find速度快很多,locate是在linux下实现快速查找文件的工具.相应的windows下有everything功能也很强大.
[root@wuzhigang lib]# updatedb
-bash: updatedb: command not found
原来是服务器中没有安装mlocate
[root@wuzhigang lib]# yum install mlocate
Loaded plugins: fastestmirror, refresh-packagekit
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: ftp.sjtu.edu.cn
* nux-dextop: li.nux.ro
* updates: mirrors.163.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mlocate.x86_64 0:0.22.2-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================
Installing:
mlocate x86_64 0.22.2-4.el6 base 86 k
Transaction Summary
=======================================================================================================================================
Install 1 Package(s)
Total download size: 86 k
Installed size: 279 k
Is this ok [y/N]: y
Downloading Packages:
mlocate-0.22.2-4.el6.x86_64.rpm | 86 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mlocate-0.22.2-4.el6.x86_64 1/1
Verifying : mlocate-0.22.2-4.el6.x86_64 1/1
Installed:
mlocate.x86_64 0:0.22.2-4.el6
Complete!
安装成功了,现在使用 updatedb 命令来创建locate命令依赖的数据库。
[root@wuzhigang lib]# updatedb
[root@wuzhigang lib]# locate passwd
整个locate工作其实是由四部分组成的:
- /usr/bin/updatedb
- /usr/bin/locate or mlocate
- /etc/updatedb.conf
- /var/lib/mlocate/mlocate.db
updatedb主要用来更新数据库,这个工作是通过crontab自动完成的.
mlocate/locate是作来完成查询功能的程序;
updatedb.conf是配置要查询哪些目录, 哪些文件;
mlocate.db则是存放文件信息的文件;
linux locate的更多相关文章
- linux locate命令
1.命令简介 locate(locate) 命令用来查找文件或目录. locate命令要比find -name快得多,原因在于它不搜索具体目录,而是搜索一个数据库/var/lib/ml ...
- Linux locate 文件搜索
在学习 兄弟连 linux教学视频 的时候,我将所学的 linux 命令记录在我的博客中,方便自己查阅. 文件处理命令:locate 基础的命令 命令名称:locate 命令的所在路径:/usr/bi ...
- linux locate: command not found
装好系统发现使用locate查找文件,提示 -bash: locate: command not found yum install locate 无效,看来locate不是软件名称 [root@ce ...
- Linux基础--文件与目录管理
1.目录与路径 1)特殊目录 . 代表此层目录 .. 代表上一层目录 - 代表前一个工作目录 ~ 代表『目前使用者身份』所在的家目录 ~account 代表account这个使用者的 ...
- linux杂记(七)linux档案与目录管理指令
1.目录的相关操作:cd,pwd,mkdir,rmdir 路径(PATH): 绝对路径:路径的写法[一定由根目录/写起],例如/usr/share/doc这个目录 相对路径:路径的写法[不是由/写起] ...
- locate命令详解
Linux locate命令 locate(locate) 命令用来查找文件或目录. locate命令要比find -name快得多,原因在于它不搜索具体目录,而是搜索一个数据库/var/lib/ml ...
- 鸟哥的私房菜:Linux文件与目录管理
1. 目录与路径 1.1 相对路径与绝对路径 绝对路径:路径的写法『一定由根目录 / 写起』,如:/usr/share/doc 这个目录. 相对路径:路径的写法『不是由 / ...
- Linux命令--文件处理
touch命令 Linux touch命令用于修改文件或者目录的时间属性,包括存取时间和更改时间.若文件不存在,系统会建立一个新的文件. ls -l 可以显示档案的时间记录. 语法 touch [-a ...
- [转帖]Linux查找文件6个高效工具
Linux查找文件6个高效工具 https://www.linuxrumen.com/rmxx/176.html 需要实操 -inname -type 等等. 1. 前言 我们使用Linux过程中,经 ...
随机推荐
- Elasticsearch学习之深入聚合分析五---案例实战
1. fielddata核心原理 fielddata加载到内存的过程是lazy加载的,对一个analzyed field执行聚合时,才会加载,而且是field-level加载的,一个index的一个f ...
- 题目1441:人见人爱 A ^ B(二分求幂)
题目链接:http://ac.jobdu.com/problem.php?pid=1441 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...
- 【黑金原创教程】【FPGA那些事儿-驱动篇I 】实验十六:IIC储存模块
IIC储存器是笔者用来练习精密控时的经典例子.<整合篇>之际,IIC储存器的解释,笔者也自认变态.如今笔者回头望去,笔者也不知道自己当初到底发什么神经,既然将IIC的时序都解释一番.由于开 ...
- Android ActivityManager与WindowManager
<uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission ...
- Shell case
case 值 in模式1) command1 command2 command3 ;;模式2) command1 command2 command3 ;;*) command1 command2 co ...
- Spark2 Linear Regression线性回归
回归正则化方法(Lasso,Ridge和ElasticNet)在高维和数据集变量之间多重共线性情况下运行良好. 数学上,ElasticNet被定义为L1和L2正则化项的凸组合: 通过适当设置α,Ela ...
- CVPR2018资源汇总
CVPR 2018大会将于2018年6月18~22日于美国犹他州的盐湖城(Salt Lake City)举办. CVPR2018论文集下载:http://openaccess.thecvf.com/m ...
- Shiro - 轻量级Java 安全框架
Apache Shiro 是一个强大易用的 Java 安全框架,提供了认证.授权.加密和会话管理等功能,对于任何一个应用程序,Shiro 都可以提供全面的安全管理服务. 并且相对于其他安全框架,Shi ...
- oracle中动态SQL使用详细介绍
Oracle编译PL/SQL程序块分为两个种:通常静态SQL采用前一种编译方式,而动态SQL采用后一种编译方式,需要了解的朋友可以参考下 1.静态SQLSQL与动态SQL Oracle编译PL ...
- Oracle安装部署之linux OS install oracle database安装脚本
#!/bin/bash#Purpose:Create and config oracle install.#Usage:Log on as the superuser('root') #1.creat ...