Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There is a file at /user/share/jogl.jar.

I am using locate jogl.jar

but it doesn't work. Why?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

From the man page:

   locate  reads  one or more databases prepared by updatedb(8) and writes
   file names matching at least one of the PATTERNs  to  standard  output,
   one per line.

Run updatedb as root and try again. It should work.

Alternatively you can use find or find | grep, which does not uses a db (and thus is considerably slower).

share|improve this answer
    
Thanks,it worked. –  rebuked Jul 17 '13 at 13:53

What do you mean by "it doesn't work" ? Two main issues come to mind, if you're not familiar with locate, both related to the fact that locate relies on a database and not directly on the file system.

  1. It doesn't display any result: in this case, you might need update locate's database by simply running updatedb from a terminal

  2. It returns way too many results: once again, locate uses a database, not the current directory (contrary to several other common unix commands), so if you try to locate somestuff from your home directory in order to find all the somestuff that it might contain, it won't work. You'll have to run it with the full path instead: locate ~/*somestuff

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.