2

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

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

3 Answers 3

6

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"
1
  • Caveat this only works for directory names, not file names.
    – BoeroBoy
    May 17, 2020 at 15:59
1

look at /etc/updatedb.conf

0

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

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

and chain as necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .