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


当前回答

### 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*"

其他回答

### 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*"

下面是另一个显示链接目录的解决方案。 我稍微喜欢它,因为它是“正常”ls -l输出的子集:

ls -1d */ | rev | cut -c2- | rev | xargs ls -ld --color=always

目录长列表

ls -l | grep  '^d'  

清单目录

ls -d */

使用这个来获得目录列表

ls -d */ | sed -e "s/\///g"

要只列出指定路径下的目录,只需键入

ls -l | grep drw