Listing only directories in UNIX

前端 未结 20 726
青春惊慌失措
青春惊慌失措 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:23

    use this to get a list of directory

    ls -d */ | sed -e "s/\///g"
    
    0 讨论(0)
  • 2020-12-12 10:23

    du -d1 is perhaps the shortest option. (As long as you don't need to pipe the input to another command.)

    0 讨论(0)
提交回复
热议问题