For any command or application
Linux namespace can be used easily with firejail like the following example
firejail --noprofile --quiet --blacklist=/path/to/exclude command-or-app
Alternative way to exclude directory from find
firejail --noprofile --quiet --blacklist=/path/to/exclude find /search/location -name am-looking-for-this
Note that this method will deny access to /path/to/exclude
, find command will print stderr with access denied
and exit status will not be 0. 2>/dev/null
can be used at the end of the command to hide stderr if needed, but keep in mind that this can hide other important errors as well. Other additional implementation like this or this may be used as well.
Find command:
Options available within find
command are explained here, here and the following example:
find . -path ./exclude/this -prune -o -print