To list directories in Linux or Unix recursively, you can use the find
utility.
To list all directories under the current directory, run the following command:
find . -type d
This will display a list of all directories under the current directory, including subdirectories.
To list only the directories at the top level of the current directory, run the following command:
find . -maxdepth 1 -type d
This will display a list of all directories at the top level of the current directory, but will not include subdirectories.
To list all directories under a specific directory, specify the path to the directory as an argument to the find
command. For example, to list all directories under the /etc
directory, run the following command:
find /etc -type d
This will display a list of all directories under the /etc
directory, including subdirectories.
That's it! You now have a list of directories in Linux or Unix, recursively.