6

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

I am using locate jogl.jar

but it doesn't work. Why?

guntbert
  • 13,134
rebuked
  • 827
  • 2
  • 7
  • 11

3 Answers3

9

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).

Alex
  • 1,249
0

For some reason, Ubuntu didn't add me, as a user, to the group that's allowed to read the default database. The solution was:

sudo usermod -a -G mlocate YOUR_USER_NAME

This information was learned by reading man updatedb and examining the permissions of the default db in /var/lib/mlocate/mlocate.db.

Dave Morse
  • 111
  • 1
  • 5
0

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

Anto
  • 2,661