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学习之深入搜索五 --- phrase matching搜索技术
1. 近似匹配 什么是近似匹配,两个句子 java is my favourite programming language, and I also think spark is a very goo ...
- VI 你不知道的事
1G 顶部 G 底部 ctrl+F 前进 ctrl+B 后退 /text 向前搜索 ?text 向后搜索 I i 插入字符串 a 光标后插入字符 A 跳到句末尾 wq 写入并退出 h k j l ...
- 【BZOJ5094】硬盘检测 概率
[BZOJ5094]硬盘检测 Description 很久很久以前,小Q买了一个大小为n单元的硬盘,并往里随机写入了n个32位无符号整数.因为时间过去太久,硬盘上的容量字眼早已模糊不清,小Q也早已忘记 ...
- CentOS 6.8下更改Apache默认网站安装目录
首先,当我们搭建好LAMP环境后,Apache服务器默认的网站安装目录是/var/www/html 然而我们搭建项目时为了方便,我们是按照自己的意愿更改网站目录的 现在假设,按照意愿设定的网站目录为/ ...
- iOS - 集成Bundle资源文件包
1.Bundle 文件 Bundle 文件,简单理解,就是资源文件包.我们将许多图片.XIB.文本文件组织在一起,打包成一个 Bundle 文件.方便在其他项目中引用包内的资源. Bundle 文件是 ...
- iOS - 开源框架、项目和学习资料汇总(网络篇)
网络连接 1. AFNetworking – ASI不升级以后,最多人用的网络连接开源库,[推荐]iOS网络编程之AFNetworking使用,iOS开发下载文件速度计算.2. Alamofire – ...
- php----空字符串的和NULL的区别
空字符串和null的区别是非常的大的,虽然都是没有任何东西,但是空字符串会占据一个内存,只是在这里内存里面没有东西而已,但是null就是完全不存在这个东西,他是不会开辟内存. $str1 = &quo ...
- 超链接 a的小手
cursor:hand 仅仅ie only,FIREFOX底下就不可以正常渲染 cursor:pointer; <span style="cursor:pointer;" ...
- Nginx配置认证登录
本配置实现Nginx认证登录以免重要信息暴露在公网 日志收集ELK展示工具kibana免费版不支持密码验证,需要设置Nginx反向代理然后关闭kibana默认端口5601使用Nginx端口登录进行用户 ...
- ZOJ 3777 - Problem Arrangement - [状压DP][第11届浙江省赛B题]
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3777 Time Limit: 2 Seconds Me ...