Two methods come to mind, find and tree. Of the two I think tree fits your question better.
Find find has the advantage that it is a basic package likely to be found in any linux distro. One disadvantage is that it will not generate a tree view. Nor will greping it for errors be easy. Instead add appropriate -perm tests. The following example will find all directories in / with user, group, and other read permission and send standard error to /dev/null
Tree
While tree may not be installed by default it is in the repos. It does create a tree view. If the user running tree does not have read permission a simple grep -v error will remove the directory from the output. However removing the errors will potentially leave extraneous formating. -d List directories only. -p Print the file type and permissions for each file (as per ls -l). grep -v prints lines not matching the pattern, error.
Two methods come to mind,
find
andtree
. Of the two I thinktree
fits your question better.Find
find
has the advantage that it is a basic package likely to be found in any linux distro. One disadvantage is that it will not generate a tree view. Nor willgrep
ing it for errors be easy. Instead add appropriate-perm
tests. The following example will find all directories in/
with user, group, and other read permission and send standard error to/dev/null
Tree
While
tree
may not be installed by default it is in the repos. It does create a tree view. If the user runningtree
does not have read permission a simplegrep -v error
will remove the directory from the output. However removing the errors will potentially leave extraneous formating.-d
List directories only.-p
Print the file type and permissions for each file (as per ls -l).grep -v
prints lines not matching the pattern,error
.