How to exclude the folders proc and sys from search with find command ?
To exclude specific paths, on Linux:
find / -path /sys -prune -o -path /proc -prune -o -type d
Another approach is to tell find
not to recurse under different filesystems.
find / -xdev -type d
You could also use locate to query a database of file names (usually updated nightly, you could also update it manually using updatedb
) instead of the live system.
locate '*' | shuf -n 1
with GNU find you may also use regex options, e. g. like this:
find / -regextype posix-extended -regex "/(sys|srv|proc)" -prune -o -type d