Friday, January 28, 2011

Linux: exclude specific file types when running "locate"

Hi,

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

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

  • look at /etc/updatedb.conf

  • 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"
    
    From
  • Hideous hack though it may be, you could always use grep:

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

    and chain as necessary.

    From MadHatter

0 comments:

Post a Comment