如何在 Linux 中查找所有以 .rb 结尾的文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5377139/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find all files ending with .rb with Linux?
提问by balaji
I am in a directory which contains more directories.
What command can I use to get all files ending with .rb
?
我在一个包含更多目录的目录中。我可以使用什么命令来获取所有以 结尾的文件.rb
?
采纳答案by bmk
You could try
你可以试试
find . -type f -name \*.rb
回答by Victor Sorokin
Try this find . -type f -name '*.rb'
.
试试这个find . -type f -name '*.rb'
。
For a more thorough explanation, get the 'Unix Power Tools' book.
要获得更详尽的解释,请获取“Unix Power Tools”一书。
回答by pechenie
This should help:
这应该有帮助:
find . | grep *\.rb
回答by vickirk
This should do it
这应该做
find . -name "*t^" -print
回答by Akshay Chopra
You can find all the files ending with .rb by following command
您可以通过以下命令找到所有以 .rb 结尾的文件
find . -type f -name '*.rb'
To store the results after finding, you can use the following command
查找后存储结果,可以使用以下命令
filesEndingWithRb=$(find . -type f -name '*.rb')
打印结果
echo $filesEndingWithRb