Linux Commands - find command - exclude directories from search (-not -path)
by
Jeremy Canfield |
Updated: August 30 2022
| Linux Commands articles
If you are not familiar with the find command, check out our Getting Started article.
Let's say you want to search below /opt but you do not want to search /opt/tmp and /opt/user. The -not -path options can be used to exclude directories from the search. For example, the following command will exclude /opt/tmp and /opt/user from the search.
find /opt -not -path /opt/tmp/ -not -path /opt/user/
Did you find this article helpful?
If so, consider buying me a coffee over at