1.find 查找文件
  【 find -name 文件名 】 在当前目录及子目录中找这个文件

  shell 命令 查找命令find,grep 随笔 第1张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。


  【 find -iname 文件名 】 在当前目录及子目录中找这个文件,不区分大小写

  shell 命令 查找命令find,grep 随笔 第2张


  【 find -name 文件名 -type  f  】 f 表示查找普通文件      -type 查找某一类型的文件  包括  b c d f(普通文件) l s p

   【  find -name a.out -type f  】 查找文件 a.out的普通文件

          shell 命令 查找命令find,grep 随笔 第3张

 

 


2.grep 查找内容

  shell 命令 查找命令find,grep 随笔 第4张


  【grep “world” file.c 】   此方式只在当前目录中查找

  shell 命令 查找命令find,grep 随笔 第5张

  【grep -i "world" file.c】 -i 忽略大小写的查找

  shell 命令 查找命令find,grep 随笔 第6张

 


  【grep -n "world" file.c】-n 把行号也显示出来

  shell 命令 查找命令find,grep 随笔 第7张

  【 grep -R "a" 】-R 当前目录包括子目录中搜索内容

  shell 命令 查找命令find,grep 随笔 第8张

 


3.whereis 查找命令或者函数所在位置

shell 命令 查找命令find,grep 随笔 第9张

 

4.which 搜索命令所在目录

 shell 命令 查找命令find,grep 随笔 第10张

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄