Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'd like to configure locate to always exclude specific file types.

For example, I would like to exclude ".pyc" ".class" "~" etc.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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:

# PRUNENAMES=".git .bzr .hg .svn"

Change it to

PRUNENAMES=".git .bzr .hg .svn .pyc"
share|improve this answer

look at /etc/updatedb.conf

share|improve this answer

Hideous hack though it may be, you could always use grep:

locate foo | grep -v ".pyc$" | grep -v ".class$"

and chain as necessary.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.