## Faster filtering / silver searcher
https://github.com/ggreer/the_silver_searcher
For faster searching, use all the above grep regular expressions with the command ag. The following is a proof of concept of its speed:
```undefined
# time ack-grep -o "\b[a-zA-Z0-9.#?$*_-]+@[a-zA-Z0-9.#?$*_-]+.[a-zA-Z0-9.-]+\b" *.txt > /dev/null
real 1m2.447s
user 1m2.297s
sys 0m0.645s
# time egrep -o "\b[a-zA-Z0-9.#?$*_-]+@[a-zA-Z0-9.#?$*_-]+.[a-zA-Z0-9.-]+\b" *.txt > /dev/null
real 0m30.484s
user 0m30.292s
sys 0m0.310s
# time ag -o "\b[a-zA-Z0-9.#?$*_-]+@[a-zA-Z0-9.#?$*_-]+.[a-zA-Z0-9.-]+\b" *.txt > /dev/null
real 0m4.908s
user 0m4.820s
sys 0m0.277s
```
## Useful Use of Cat
Contrary to what many veteran unix users may believe, this happens to be one of the rare opportunities where using cat can actually make your searches _faster_. The SilverSearcher utility is (at the time of this writing) not quite as efficient as cat when it comes to reading from file handles. Therefore, you can pipe output from **cat** into **ag** to see nearly a 2x real time performance gain:
```undefined
$ time ag -o '(^|[^a-fA-F0-9])[a-fA-F0-9]{32}([^a-fA-F0-9]|$)' *.txt | ag -o '[a-fA-F0-9]{32}' > /dev/null
real 0m10.851s
user 0m13.069s
sys 0m0.092s
$ time cat *.txt | ag -o '(^|[^a-fA-F0-9])[a-fA-F0-9]{32}([^a-fA-F0-9]|$)' | ag -o '[a-fA-F0-9]{32}' > /dev/null
real 0m6.689s
user 0m7.881s
sys 0m0.424s
```
[](https://www.facebook.com/sharer/sharer.php?u=https://www.unix-ninja.com/p/A_cheat-sheet_for_password_crackers&title=A%20cheat-sheet%20for%20password%20crackers)
[[Home]]