I'd like to configure locate to always exclude specific file types.
For example, I would like to exclude ".pyc" ".class" "~" etc.
Hideous hack though it may be, you could always use grep:
locate foo | grep -v ".pyc$" | grep -v ".class$"
and chain as necessary.
This is a duplicate question from superuser.com:
In updatedb.conf, uncomment the PRUNENAMES line and add the extension .pyc. On my Ubuntu system by default it reads:
Change it to