列出带有ls的子目录 [英] List sub-directories with ls

查看:74
本文介绍了列出带有ls的子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么用ls列出子目录,用'-d'仅显示当前目录.我想要类似find . -type d -maxdepth 1的东西给我.

How could I list sub-directories with ls, with '-d' only the current directory is shown. I want something like find . -type d -maxdepth 1 would give me.

推荐答案

这应该有所帮助:

ls -d */

*/将仅匹配当前目录下的目录.输出目录名称可能会包含结尾的"/".

*/ will only match directories under the current dir. The output directory names will probably contain the trailing '/' though.

这篇关于列出带有ls的子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆