I use tree command to get files and directories under the /usr path,

tree -pgufi /usr

Does it have a way to filter files/directories under this path according to several conditions(1 and 2 and 3)?

  1. file permissions=777
  2. file owner is not root
  3. file extension name is .so

1 Answer 1


tree offers no filtering outside of file names, however it offers to display the owner and permissions of the files it displays with its -u and -p flags.

I would therefore enable these flags and pipe the result to a tool that will implement the filters :

tree -P *.so -up /usr | grep -v "root\s*]" | grep "\[.rwxrwxrwx"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .