Listing only directories in UNIX

前端 未结 20 890
青春惊慌失措
青春惊慌失措 2020-12-12 09:40

I want to list only the directories in specified path (ls doesn\'t have such option). Also, can this be done with a single line command?

20条回答
  •  醉话见心
    2020-12-12 10:14

    Since there are dozens of ways to do it, here is another one:

    tree -d -L 1 -i --noreport
    
    • -d: directories
    • -L: depth of the tree (hence 1, our working directory)
    • -i: no indentation, print names only
    • --noreport: do not report information at the end of the tree listing

提交回复
热议问题