Using find / will normally be very slow. Using locate is much faster but somewhat imprecise because it doesn't support anything more complex than substring matching. A directory called .pembroke will be found and returned by locate along with every file inside it.
A combination of locate and grep, however, has speed and precision. Conveniently, it also does not require sudo.
locate .pem | grep "\.pem$"
The downside? The database locate uses is normally only updated once per day so any recent changes (additions, deletions, name changes, etc.) will not be found.
You're on the right track -- you just need to quote the pattern so that it gets interpreted by
find
and not by your shell:Using
find /
will normally be very slow. Usinglocate
is much faster but somewhat imprecise because it doesn't support anything more complex than substring matching. A directory called.pembroke
will be found and returned by locate along with every file inside it.A combination of
locate
andgrep
, however, has speed and precision. Conveniently, it also does not requiresudo
.The downside? The database
locate
uses is normally only updated once per day so any recent changes (additions, deletions, name changes, etc.) will not be found.Almost!
or
otherwise the shell will interpret the * instead of find.
...or if mlocate runs on your computer and you don't need the most actual data use locate command
It's faster becouse it finds files in previously created database; not on whole system.
Think that should work.