Solved

locate command not work as expected

Posted on 2011-03-21
6
367 Views
Last Modified: 2012-08-13
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
Comment
Question by:andieje
[X]
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
6 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 250 total points
ID: 35185295
First use updatedb

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

Expert Comment

by:Tintin
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 *.


0
 
LVL 6

Expert Comment

by:jghelfman40
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 )

0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

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

Assisted Solution

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

or updatedb as root
0
 
LVL 6

Expert Comment

by:mohansahu
ID: 35204817
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

635 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