The command tree -I 'node_modules' prevents the node_modules folder from appearing in the output. Likewise, tree -I 'app/ui/bower_components' prevents app/ui/bower_components from appearing in the output.

However, tree -I 'node_modules' -I 'app/ui/bower_components' doesn't prevent both from appearing in the output. Instead, it appears the last one is used.

So, how do you ignore multiple folders using tree?

1 Answer 1


You can use | to separate patterns, in your example you can do

tree -I "node_modules|bower_components"

You need the double quotation marks so that bash won't interpret the pipe character.

If you look at the man pages for tree, read the one for the -P argument instead of the -I (just above).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.