Skip to content

Instantly share code, notes, and snippets.

@bijay-shrestha
Last active June 12, 2019 05:09
Show Gist options
  • Save bijay-shrestha/a36f6987befb105b0dcb9b97a471dfe7 to your computer and use it in GitHub Desktop.
Save bijay-shrestha/a36f6987befb105b0dcb9b97a471dfe7 to your computer and use it in GitHub Desktop.
tree: ignore directories with patterns

tree: ignore directories with patterns

tree displays the directory structure of the current directory. -d option displays only directories. -I option allows to exclude directories that match specific pattern e.g.

tree -I node_modules

In order to exclude multiple directories at once, their names must be separated by | sign, i.e.

tree -I 'node_modules|cache|test_*'
tree -I 'node_modules|cache|src|public|test_*'

This command will skip node_modules, cache directories (along with their content) from the output, and all directories that match test_* wildcard expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment