List directories recursively in linux/unix
August 25, 2020
Recursive listing of directories can help us begin to understand the current directory structure.
In linux/unix, we can use any of the following commands to list files and directories recursively:
Use the ls command to recursively list directories
Type the following command list subdirectories recursively using the ls command:
ls -R .
ls -Rl .

Use the find command to recursively list directories
find . -type d
find . -ls
find . -print

Use the du command to recursively list directories
du -a .
0 ./dir/subDir/a/b
0 ./dir/subDir/a
0 ./dir/subDir
0 ./dir
0 .
Use the tree command to recursively list directories
tree
.
└── dir
└── subDir
└── a
└── b
4 directories, 0 files