UNIX Shell-在一个文件夹下找到所有不同类型的文件扩展名
有关外壳命令的小问题。
我有一个顶级文件夹,其中包含不同类型的扩展名的文件。 例如,该文件夹包含文件.java,.xml等...
在此顶级文件夹下,它还包含基础文件夹,儿童文件夹,它们本身包含相同和/或其他类型的文件,以及其他可能的其他儿童文件夹。
我正在尝试将所有类型的文件列在顶级文件夹下,一直向下。
我尝试使用命令查找,但它要求我提前知道所有类型,我不知道。
请问,请问获取所有类型的文件的正确命令是什么?
预期的结果输出就像:
- .java
- .xml
- .png
(如果可能的话,使用计数,但可以完全可以)
- .java 86
- .xml 23
- .png 42
Small question regarding a Shell command please.
I have a top level folder, which contains files of different types of extensions.
For instance, the folder contains files .java, .xml, etc...
Under this top level folder, it contains also underlying folders, child folders, which themselves contains same and/or other types of files, and possibly other child folders.
I am trying just to list all the types of files under the top level folder, all the way down.
I tried using the command find, but it requires me to know in advance all the types, which I do not know.
May I ask, what is the correct command to get all types of files please?
An expected result output would be like:
- .java
- .xml
- .png
(if possible, with the count, but totally ok if not)
- .java 86
- .xml 23
- .png 42
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
或使用bash:
或任何外壳(与Newlines的文件名无法正常运行;但是,如果使用GNU Userland工具,则有一些方法):
or using bash:
or any shell (Won't work well with filenames with newlines; there are ways around that if using, say, GNU userland tools, though):