Find the answer to your Linux question:
Results 1 to 4 of 4
I was going over this article in which the author used locate. I wanted to know is there anyway to make locate only search in the current directory >> locate ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    68

    Question using Locate


    I was going over this article in which the author used locate.
    I wanted to know is there anyway to make locate only search in the current directory
    >> locate ./ "*zip*"
    and frankly the results that get displayed do not have zip in them .
    How do i make locate only search the current directory ??

  2. #2
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    To be honest, you might have more luck using find.
    Code:
    man find
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  3. #3
    Just Joined!
    Join Date
    Oct 2011
    Posts
    68
    I know i am even more familiar and comfortable with find. I wonder why do people even use "locate" other than the fact that its a bit faster however having a serious downside o being inaccurate sometimes. So does this mean locate cant be customized to search in a particular directory ?? I cant seem to find anything on the internet in this regard..
    Last edited by zedan85; 01-25-2012 at 12:34 AM.

  4. #4
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    locate is useful specifically because it will hunt down a file anywhere in your filesystem. It does this by reading a database created by updatedb. I know that's not news to you... it's mentioned in the man page for locate.
    But I don't think you can use different search options with locate. This is by design.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •