![](/style/images/good.png)
8
![](/style/images/bad.png)
文件名的搜寻 whereis, locate, find
source link: https://blog.51cto.com/u_14068620/5754941
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
文件名的搜寻 whereis, locate, find
精选 原创whereis
whereis [ -bmsu] [ -BMS directory…-f] filename…
参数 | 作用 |
---|---|
-b | 只寻找 binary 二进制 格式的文件 |
-m | 只寻找在 说明文件 manual 路径下的文件 |
-s | 只寻找 source 来源的文件 |
-u | 搜寻不在上述三个项目当中的其他特殊文件 |
-l | 查看 whereis 可搜寻的路径 |
[ root@www ~]# whereis /etc/passwd
passwd: /usr/bin/passwd /etc/passwd.OLD /etc/passwd /usr/share/man/man1/passwd.1.gz
/usr/share/man/man5/passwd.5.gz
[ root@www ~]# whereis man
man: /usr/bin/man /etc/man.config /usr/share/man /usr/share/man/man7/man.7.gz
/usr/share/man/man1p/man.1p.gz /usr/share/man/man1/man.1.gz
locate
locate [ -ir] keyword
参数 | 作用 |
---|---|
-i | 忽略大小写的差异 ; |
-r | 后面可接正规表示法的显示方式 |
- 安装软件
mlocate
之后才会有updatedb
命令和locate
命令,最小化安装的 rhel 系统默认不安装。 locate
寻找的数据是由『已建立的数据库/var/lib/mlocate/mlocate.db
里面的数据所搜
寻到 , 所以不用直接在去硬盘中存取数据 , 速度快updatedb
: 根据/etc/updatedb.conf
的设定去搜寻系统硬盘内的文件名 , 并更新/var/lib/mlocate.mlocate.db
PRUNEPATHS = "/afs /media /net /sfs /tmp /udev /var/cache/ccache /var/spool/cups /var/spool/squid /var/tmp"
<== 设定了不搜寻的目录
find [ PATH] [ option] [ action]
选项与参数 :
- 与时间有关 :-atime, -ctime ,-mtime , 以 -mtime 说明
- -mtime n
- -mtime +n
- -mtime -n
- -newer file : 列出比 file 还要新的档案
if n= 2 now= 2015/12/24
then
-mtime 2: 2015/12/22 当天内容改过的文件
-mtime +2: 2 天之前 , 2015/12/22 之前被容被改过的文件 , 及 21\20\19...
-mtime -2: 2 天以内 , 2015/12/24 和 2015/12/23 号修改过的文件
<--|--|--|--|--|--|--|--|--|--|--|2-|--|--|
<----------------------------+2->|--|--|--|
<--|--|--|--|--|--|--|--|--|--|--|--|<-2->|
11 12 13 14 15 16 17 18 19 20 21 22 23 24 现在
- 赞
- 收藏
- 评论
- 分享
- 举报
上一篇:软硬方式链接
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK