Linux命令之locate

locate也是用于查找文件的命令,与find类似,但是比find快很多,因为该命令会自动找到数据库/var/lib/mlocate/mlocate.db

这个文件是Linux自动记录我们系统的文件,系统会定期的更新该文件

我们来试一下该命令:

一、准备工作、

安装locate,因为Linux自带是没有这个的

yum install mlocate

二、使用locate

[root@hadoop001 /]# locate /etc/yu
/etc/yum
/etc/yum.conf
/etc/yum.conf.rpmnew
/etc/yum.repos.d
/etc/yum/pluginconf.d
/etc/yum/protected.d
/etc/yum/vars
/etc/yum/version-groups.conf
/etc/yum/pluginconf.d/fastestmirror.conf
/etc/yum.repos.d/10gen.repo
/etc/yum.repos.d/CentOS-Base.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel.repo.rpmnew
/etc/yum.repos.d/erlang_solutions.repo
/etc/yum.repos.d/kernel6.repo
/etc/yum.repos.d/remi.repo
/etc/yum.repos.d/rpmforge.repo

注:我们在平时很可能会遇到,locate查到已经删除或者是刚建的文件查不到,原因是数据库文件/var/lib/mlocate/mlocate.db没有更新,因此,我们可以使用这个命令:

updatedb

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值