shell 命令 查找命令find,grep

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

  


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

  


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

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

          


2.grep 查找内容

  


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

  

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

  


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

  

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

  


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

4.which 搜索命令所在目录

 

猜你喜欢

转载自www.cnblogs.com/electronic/p/10821758.html