Linux command to print directory structure in the form of a tree

后端 未结 9 1051
野趣味
野趣味 2020-11-28 00:05

Is there any linux command that I can call from a Bash script that will print the directory structure in the form of a tree, e.g.,

folder1
   a.txt
   b.txt
         


        
9条回答
  •  天命终不由人
    2020-11-28 00:54

    To add Hassou's solution to your .bashrc, try:

    alias lst='ls -R | grep ":$" | sed -e '"'"'s/:$//'"'"' -e '"'"'s/[^-][^\/]*\//--/g'"'"' -e '"'"'s/^/   /'"'"' -e '"'"'s/-/|/'"'"
    

提交回复
热议问题