Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


locate command not work as expected

Posted on 2011-03-21
Medium Priority
Last Modified: 2012-08-13

Why does the locate command not work as expected? It is easiest to explain what I did by pasting in the commands. But the file does exist and I am the file owner


oscar:registry$ locate icg*
oscar:registry$ ls -l

-rw-r--r-- 1 andrea andrea   555775 2011-03-21 18:07 default.xml
-rw-r--r-- 1 andrea andrea 49960754 2011-03-21 18:07 icgc3.xml

oscar:registry$ locate icg

Open in new window

Question by:andieje
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 31

Accepted Solution

farzanj earned 1000 total points
ID: 35185295
First use updatedb

It would run for a little while and then run locate again
LVL 48

Expert Comment

ID: 35185305
Assuming the locate database has been updated, then you should do

locate "icg*"

Open in new window

without the quotes, shell globbing expands the *.


Expert Comment

ID: 35185313
If these are relatively newer files, the locate database may not have them. Locate database is updated via cron on your system. See if you have results for anything. (ie. locate messages |less )

Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!


Author Comment

ID: 35185372
andrea@oscar:~$ updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
LVL 35

Assisted Solution

by:Seth Simmons
Seth Simmons earned 1000 total points
ID: 35185382
sudo updatedb

or updatedb as root

Expert Comment

ID: 35204817

i think your linux locate command is not yet,here you can run updatedb command.

login into command line terminal and su - to gain root privilege.

[mohan@sftpserver ~]$ su -
[root@sftpserver ~]# updatedb

if you are using Ubuntu, use sudo updatedb command and provide your password.


Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question