ack代码搜索命令
1、CentOS下可以直接yum安装:yum install ack
2、举例,以关键字“koa”搜索.js文件(--js),忽略大小写(-i),忽略static目录:
ack --js "koa" -i --ignore-dir=static
3、支持很多种代码类似,也可以自定义代码类型搜索,具体可以使用ack --help=types 查看,部分如下:
ack --help=types
Usage: ack [OPTION]... PATTERN [FILES OR DIRECTORIES]
The following is the list of filetypes supported by ack. You can
specify a file type with the --type=TYPE format, or the --TYPE
format. For example, both --type=perl and --perl work.
Note that some extensions may appear in multiple types. For example,
.pod files are both Perl and Parrot.
--[no]actionscript .as .mxml
--[no]ada .ada .adb .ads
--[no]asm .asm .s
--[no]asp .asp
--[no]aspx .master .ascx .asmx .aspx .svc
--[no]batch .bat .cmd
--[no]cc .c .h .xs
--[no]cfmx .cfc .cfm .cfml
--[no]clojure .clj .cljs .edn .cljc
--[no]cmake CMakeLists.txt; .cmake