I wish to have the command locate in ubuntu 12.04 (which is used for finding files. I believe there is such a command but I cannot see it in ubuntu 12.04 Is it part of any package?
Asked
Active
Viewed 2.2e+01k times
101
Evandro Silva
- 9,922
JVIyer
- 1,011
- 2
- 7
- 3
2 Answers
135
sudo apt-get install mlocate should install the 'locate' command.
mlocate maintains a database of all your files and is re-indexed once a day by default. If you want it to re-index immediately then run sudo updatedb from the command line.
If you get a cannot stat error when you run locate, then you need to run sudo updatedb to populate the database, just as if you wanted to re-index immediately.
From Ubuntu 22.04 onwards, mlocate is a transitional dummy package that installs plocate, so you can run sudo apt-get install plocate instead to install plocate directly.
muru
- 207,228
Thomas Ward
- 78,878