Contents
  1. 1. 一、locate
  2. 2. 二、whereis
  3. 3. 三、which
  4. 4. 四、find
  5. 5. 五、grep

一、locate

1
2
3
4
/etc/updatedb.conf #locate配置文件筛选规则
locate file
/var/lib/mlocate #筛选数据库
updatedb #更新数据库,以用来搜索最新的文件

二、whereis

1
whereis -b -m 

三、which

1
which ll  #会搜索文件别名

四、find

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
find / -name install.log
find /root -name "install.log*"
find /root -iname install.log #不区分大小写
find /root -nouser #搜索没有所有的文件
find /var/log/ -mtime +10 #查找10天前修改的文件

-10 10天以内
10
+10 10天前

atime
ctime
mtime 修改文件内容

find /root -size -25k
find /root -inum 22222 #通过i结点查找文件
-a and
-o or
find /etc -size +20k -a -size -50k -exec ls -lh {} \

五、grep

1
2
grep -i #不区别大小写
grep -v #取反
Contents
  1. 1. 一、locate
  2. 2. 二、whereis
  3. 3. 三、which
  4. 4. 四、find
  5. 5. 五、grep