find命令递归查找_从命令行递归查找

find命令递归查找

Probably a dozen times a day I need to search any given project for specific code keywords.  Most of the time it's within a specific project but then there are times where I don't remember which directory or project the specific text is -- from my blog to my many Mozilla projects, I have code all over my local machine and it's oftentimes difficult to find something I need.

大概每天需要十几次,我需要在任何给定的项目中搜索特定的代码关键字。 多数情况下,它在特定项目中,但是有时我不记得特定文本在哪个目录或项目中-从我的博客到我的许多Mozilla项目,我在本地计算机上都拥有代码,而且通常很难找到我需要的东西。

Most of the time I need to open my text editor and have it do the hard work of what I'm looking for but that's probably not efficient -- a more efficient tool would come from command line and thanks to CommandLineFu.com, I found the perfect command:

大多数时候,我需要打开文本编辑器并让它完成我要查找的内容,但是这可能效率不高-一个更高效的工具将来自命令行,这要归功于CommandLineFu.com ,我发现完美的命令:


# Search all ".js" files for "debounce"
# Spits out file path, line number, and snippet where string appears
find . -name "*.js" -exec grep -in -H "debounce" {} \;


The command above searches files recursively to find the desired string, outputting the source file and the text which the string occurs in!

上面的命令以递归方式搜索文件以找到所需的字符串,输出源文件和该字符串所在的文本!

翻译自: https://davidwalsh.name/recursive-find

find命令递归查找

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值