Reputation: 51
I'm looking for an alternative to 'Tree' command in Linux however I want it to be based on NOT a recursive algorithm.
Tree command is based on a recursive algorithm, as seen from its description:
Tree is a recursive directory listing program that produces a depth indented listing of files.
Is there another way which is not recursive?
Thank you!
Upvotes: 0
Views: 3154
Reputation: 2090
I think you might be looking for the -d flag which only shows the directory tree (with no files). From the tree man page:
-d
List directories only.
tree -d /path/to/dir
Upvotes: 0
Reputation: 325
With tree -L <level>
you can specify how many level directories deep to descend. In your case it would be:
tree -L 1
Upvotes: 4