我想只列出指定路径中的目录(ls没有这样的选项)。 另外,这可以用单行命令完成吗?


当前回答

尝试使用ls -d */来列出当前目录中的目录

其他回答

ls -l | grep '^d'

您可以创建一个别名并将其放入配置文件中

alias ld="ls -l| grep '^d'"
### If you need full path of dir and list selective dir with "name" of dir(or dir_prefix*):
find $(pwd) -maxdepth 1 -type d -name "SL*"

Du -d1可能是最短的选项。(只要您不需要将输入管道输送到另一个命令即可。)

尝试使用ls -d */来列出当前目录中的目录

目录长列表

ls -l | grep  '^d'  

清单目录

ls -d */