silversearcher-ag命令(Recursively search for PATTERN in PATH)

本文介绍了一款名为ag的强大搜索工具,它不仅功能强大且搜索速度快于传统的grep-r命令。文章详细展示了如何在CentOS和Ubuntu系统中安装ag,并通过实际例子演示了如何使用ag进行高效的文件内容搜索。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

如果你有使用grep -r的经历, 那么其搜索速度可能会让人抓狂. ag命令比grep -r功能强太多, 而且搜索速度非常快!

官网

https://github.com/ggreer/the_silver_searcher

安装

centos系统安装:

sudo yum install the_silver_searcher

ubuntu系统安装:

sudo apt install silversearcher-ag

使用

$ pwd
/data/soft/istio-1.13.4
$ ag 'kind: Service' | head  
samples/extauthz/ext-authz.yaml:18:kind: Service
samples/extauthz/local-ext-authz.yaml:19:kind: ServiceEntry
samples/extauthz/local-ext-authz.yaml:35:kind: ServiceEntry
samples/extauthz/local-ext-authz.yaml:81:kind: Service
samples/extauthz/local-ext-authz.yaml:96:kind: ServiceAccount
samples/ratelimit/rate-limit-service.yaml:40:kind: Service
samples/ratelimit/rate-limit-service.yaml:77:kind: Service
samples/websockets/app.yaml:2:kind: Service
samples/helloworld/gen-helloworld.sh:48:kind: Service
samples/helloworld/helloworld.yaml:2:kind: Service

(完)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值