• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 377
  • Last Modified:

locate command not work as expected

HI

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

thanks

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
oscar:registry$

Open in new window

0
andieje
Asked:
andieje
2 Solutions
 
farzanjCommented:
First use updatedb

It would run for a little while and then run locate again
0
 
TintinCommented:
Assuming the locate database has been updated, then you should do

locate "icg*"

Open in new window


without the quotes, shell globbing expands the *.


0
 
jghelfman40Commented:
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 )

0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
andiejeAuthor Commented:
andrea@oscar:~$ updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
0
 
Seth SimmonsSr. Systems AdministratorCommented:
sudo updatedb

or updatedb as root
0
 
mohansahuCommented:
Hi,

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.

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

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

MS
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now