Solved

locate command not work as expected

Posted on 2011-03-21
6
329 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
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
docker invalid registry name 2 104
Just want to learn, how Linux D2B works, under Linux bash shell 6 57
Oracle 12c patching 1 59
nagios alerts 3 32
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

943 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now