1. IMPORTANT - 11/13/2015: In light of a possible breach we have scrubbed all passwords. You will need to request a password reset through the site. Click here for more information.

want to use Locate instead of find as it gives some faster results

Discussion in 'General Linux' started by technocp, Mar 22, 2012.

  1. technocp

    technocp New Member

    Mar 22, 2012
    Likes Received:
    I am using 1-3 TB disks on server

    I used locate command to find files and it was all going well. Then came the need of using some more parameters for finding like finding by size, finding by time & date, etc.

    So I used the locate command and its database as follows
    sudo find $(locate somefile) -<findoption>
    it gave me good results. BUT

    everything was messed up when it was about finding files that have spaces in its name.

    if filenames have spaces then find command divides the output provided by locate command

  2. Rob

    Rob Administrator Staff Member

    Oct 27, 2011
    Likes Received:
    You're making my brain hurt...

    I know you could preserve spaces by passing print0, etc.. like:

    find /path/ -name blah -print0 | xargs -0 command

    Trying to think how you could use it in your situation though..

Share This Page